Re:Generalizing JSX: Delivering on the Dream of Curried Name...
by draw_down on Thursday March 24, 2016 @02:46PM
(#11355288)
A certain portion of programmers seems convinced that currying offers a huge amount of power, and we just haven't unlocked it yet. But I don't think I understand why they feel that way.
[ Parent
| on HN ]
Re:Generalizing JSX: Delivering on the Dream of Curried Name...
by k__ on Thursday March 24, 2016 @05:05PM
(#11356428)
It's just a different way of structuring.
api = new Api('http://my.cool.api')
api.get('/it')
api.post('/it')
// connect = rootUrl => method => endpoint
api = connect('http://my.cool.api')
get = api('GET')
post = api('POST')
get('/it')
post('/it')
Re:Generalizing JSX: Delivering on the Dream of Curried Name...
by darawk on Thursday March 24, 2016 @03:06PM
(#11355481)
It mostly allows you to write extremely short code.
E.g. `sumList = reduce(sum)`
It has a variety of drawbacks though, like being harder to inspect at runtime, and arguably harder to read.
Re:Generalizing JSX: Delivering on the Dream of Curried Name...
by tolmasky on Thursday March 24, 2016 @03:10PM
(#11355508)
Yup, couldn't agree more and that's exactly one of the concerns I'm trying to address in the blog post ("All in all, the resulting effect in my exprience is that currying makes writing code far more pleasurable, but often makes reading code somewhat confusing."). I think the combination of named parameters actually makes it more readable.
Re:Generalizing JSX: Delivering on the Dream of Curried Name...
by e_d_g_a_r on Thursday March 24, 2016 @04:58PM
(#11356372)
it offers some elegance, here's a timeout function blogpost.
http://hyegar.com/2016/03/22/simple-timeouts/
In it the timeout function only takes one arg for its timeout wrapped function, so how do we use functions with more than 1 arg? Via currying