filter odd - filter odd - does that filter out or filter to keep?
let - basic let revived!
incr = a : incr (a+1) - a function 'incr' that given a number will return a list starting with it and continue with calling myself ('incr') with the next number (infinite lazy recursion)
in - given those lets, ok here comes the actual expression...
take 10 - yeah: give me 10 numbers
$ - why don't we just add a dollar to every line? (no we missed one...)
incr 1 - call the function 'incr' that we 'let' above with 1. It'll give 1,2,3...
Haskell list comprehension
[s | i <-- [1..10], odd i, let s = i * i, s < 50]
That's cool! However, still..
[ ... ] - returning a list
s - return s. What s?
| - bar... but these...
i - we have to name them something (why?)
<- - forward assignment from list implying... a loop?
[1..10] - another list (comprehension) with special syntax gives numbers 1 to 10
, - ok another item coming, of expressions
odd i - a guess it's an implied filter predicate if it returns boolean?
let - OK, can't say s <- on single value, how come I need no "in"? and it's avaible above the let? what's the scope of this thing?
s < 50 - implicit filter on each value of i/s, ok if s less than 50