News for hackers. Stuff that matters.
Re:Curry flavored promises by gberger on Sunday April 27, 2014 @10:24PM (#7657930)

    //here's an AJAX request and a chain of promises
    m.request({method: "GET", url: "/api/projects"})
        .then(console.log) // log all projects
        .then(pastItems) // filter past projects
        .then(console.log) // log past projects only
The calls to console.log will not work.

You need to do this:

    .then(function() { console.log(arguments); })

Or this:

    .then(console.log.bind(console))
Re:Curry flavored promises by gonzoisme on Sunday April 27, 2014 @10:40PM (#7657967)
Yeah, the example couldn't work. Also, isn't this an example of partial application, not currying?
Re:Curry flavored promises by ephemeralgomi on Sunday April 27, 2014 @10:53PM (#7658001)
Yup.
Re:Curry flavored promises by judk on Sunday April 27, 2014 @10:55PM (#7658005)
Funny this mistake rarely goes the other direction. Probably because 'curry' is a fin word.

I propose 'parry' for "partial application", to satisfy the punsters without compromising accuracy.

Re:Curry flavored promises by cwmma on Monday April 28, 2014 @08:47AM (#7659513)
this

    console.log.bind(console)
doesn't work in old IE you need to do

    Function.prototype.bind.call(console.log, console)
Re:Curry flavored promises by _ZeD_ on Sunday April 27, 2014 @10:47PM (#7657985)
well, it depends on the console.log implementation :)

On firefox I get

    >>> console.log.call(undefined, "Hi")
    Hi
Re:Curry flavored promises by bendrucker on Monday April 28, 2014 @08:06AM (#7659377)
console.log is bound in Firefox and in Node. In all other browsers calling console.log.call(null) is a TypeError.