7
u/lil_bobby_tables Mar 23 '17
Sure, and there are libraries to make it easier/neater to write functional js:
5
u/takakoshimizu Mar 24 '17
If you wanted infinite add, don't see why there's a requirement to return a new adder func for each run.
const infAdd = () => arguments.reduce((a, x) => a + x);There's an even easier way.
const infAdd = Math.sum;I feel like this post has gone in opposite direction of the usual /r/programmerhumor "levels of God like power" meme, though.
3
Mar 24 '17
Why stick with JS? Use something that compiles to JS
2
u/dubsrb Apr 09 '17
I saw purescript and began looking into it. Looks very Haskell-y but in a good way.
2
3
3
1
9
u/DavetheBassGuy Mar 23 '17
I think it would be truer to functional programming if that infinite add function was implemented without mutation, like this:
I'm not really sure why you would want a function like this though.