beastaugh / udon

Practical functional programming in JavaScript
http://extralogical.net/projects/udon
Other
70 stars 1 forks source link

Compose Bug #3

Closed moonglum closed 13 years ago

moonglum commented 13 years ago

I ran into the following errors when running the examples from the documentation (in Safari):

var ceilMax = Udon.compose([Math.ceil, Math.max], 2);

/* ceilmax is now:

function () {
            var a2 = a1.concat(Udon._slice.call(arguments, 0));
            if (a2.length < n) {
                a2.unshift(f);
                a1 = a2;
                return accumulator;
            } else {
                return f.apply(null, a2);
            }
        }
*/

ceilMax(0.7)(1.1);
/* -> TypeError: Result of expression 'ceilMax(0.7)' [NaN] is not a function. */

ceilMax(0.7);
/* -> NaN */
beastaugh commented 13 years ago

Looks like this is the ncurry bug in a different guise—it should be fixed now. I'm adding a regression test.