News for hackers. Stuff that matters.
Re:Introducing a new data structure, streams, in Javascript by encoderer on Sunday September 11, 2011 @01:27PM (#2984221)
Just curious -- and be honest -- the snippet at the end they ask you to decipher (and they say "Most programmers find it hard to understand unless they have a functional programming background, so don't feel bad if you don't get it immediately") did you have trouble with it?

For me, I thought I had the answer after maybe 30 seconds of reading it, but decided to "check my work" by walking through it again, and only then, a moment later, did I realize what it was actually doing with that recursive call.

I'm just curious about their "most programmers without a functional background" remark. So: did ya get it?

Re:Introducing a new data structure, streams, in Javascript by pingswept on Sunday September 11, 2011 @01:35PM (#2984246)
Yes, but it would have been significantly more baffling if the word "sieve" didn't hint at its behavior.

Still, I'm not sure that a functional background would have helped, or maybe my background is more functional than I think. I know some Python, and I read a few articles about functional programming a couple of years ago, but I don't think I could give you a clear definition of what functional programming is.

Re:Introducing a new data structure, streams, in Javascript by romey on Tuesday September 13, 2011 @04:24PM (#2993359)
The name "sieve" gave it away for me before I'd even looked at the code, but I decided to make sure I was right. Then i looked at it and my mind was kind of blown but how neat and concise it was. This definitely makes me want to take a look at functional programming (just ordered "The Little Schemer")
Re:Introducing a new data structure, streams, in Javascript by riffraff on Monday September 12, 2011 @02:37AM (#2986101)
I don't have a big experience with functional languages, but I got it quickly too. As written in the page, the name is too much of a giveaway.