Re:Introducing "Functional JavaScript"
by johnpmayer on Wednesday March 20, 2013 @10:38AM
(#5407488)
I think that because TCO is all but inevitable in future engines/standards, starting to use functional patterns now for the programming benefits is worthwhile.
[ Parent
| on HN ]
Re:Introducing "Functional JavaScript"
by jcampbell1 on Wednesday March 20, 2013 @11:47AM
(#5407954)
Be my guest. Start using this implementation of each. Let me know if you run into any problems.
function each(arr,fn,pos) {
pos = pos || 0;
fn(arr[pos++])
if(pos < arr.length)
each(arr,fn,pos);
}
Seems like a recipe for a disaster.I prefer Underscore's implementation of `each`. It doesn't blow the stack. http://underscorejs.org/docs/underscore.html#section-13