3 ms·
It meshes pretty well as is. If only I could get rid of the strings and redundant arguments. mymap = pattern { '_, []' : -> [] 'f, [x, xs...]' : (f,
by natefaubion 14y ago
It meshes pretty well as is. If only I could get rid of the strings and redundant arguments.
mymap = pattern {
'_, []' : -> []
'f, [x, xs...]' : (f, x, xs) ->
[f x].concat mymap(f, xs)
}
It shares a lot of the same splat/rest/destructuring syntax.
- oscilloscope 14y agoCheck out LiveScript's implicit switch syntax: http://gkz.github.com/LiveScript/#switch http://gkz.github.com/LiveScript/#switch
- natefaubion 14y agoThat's along similar lines, but more like guards in Haskell: http://en.wikibooks.org/wiki/Haskell/Control_structures http://en.wikibooks.org/wiki/Haskell/Control_structures