Fun.js – Just a sketch
blog.fogus.me
Fun.js – Just a sketch
1–10 of 22 posts
Re: Fun.js – Just a sketch
#2Re: Fun.js – Just a sketch
#3What would you say are the skills required to fully understand this?
Re: Fun.js – Just a sketch
#4What would you say are the skills required to fully understand this?
Re: Fun.js – Just a sketch
#5It returns true on values such as NaN, zero, or an empty string. I don't think I'm alone in considering those to be "falsy" values, for example:
Re: Fun.js – Just a sketch
#6 function double(n) { return 2*n; }
map(double, [1,2,3])
//=> [1, 4, 9]
should be => [2, 4, 6] function greaterThan(l, r) {
return l > r;
}
greaterThan(5, 100);
//=> true
should be => false maybeGT(5)(10000000);
//=> false
Based on your earlier declaration of greaterThan this result is actually correct. The curried application ordering is also correct and flip is unneeded. schonfinkel(function(a1,a2) {return [a1,a2];})(1)(2);
//=> [1, 2]
I would proofread the rest but I am about to be late for class! =OEdit: since i'm going to complain I might as well say something nice as well. I did like this article example correctness aside, and I hadn't seen that implementation of pipeline before! Much awesome. =)
Re: Fun.js – Just a sketch
#7Re: Fun.js – Just a sketch
#8Sorry to nitpick, but I got hung up right at the beginning with his "truthy" function. It returns true on values such as NaN, zero, or an empty string. I don't think I'm alone in considering those to be "falsy" values, for example: http://www.sitepoint.com/javascript-truthy-falsy/
Re: Fun.js – Just a sketch
#9Re: Fun.js – Just a sketch
#10Sorry to nitpick, but I got hung up right at the beginning with his "truthy" function. It returns true on values such as NaN, zero, or an empty string. I don't think I'm alone in considering those to be "falsy" values, for example: http://www.sitepoint.com/javascript-truthy-falsy/
Technically the are JS falsey, but I choose not to treat them that way. I rarely want to treat the result of a calculation as a boolean condition. However, I often want to know if a calculation isNaN or isEmpty. Just because something is falsey doesn't mean it should be treated that way universally.
Btw, I should have said first: I love the article in general and it's great to see these techniques becoming more mainstream in javascript. Thank you!