## #haskell - Tue 27 Mar 2007 between 00:00 and 00:03

### NY Lost Funds

 dons secondly, you'd start by looking at the type of foldl :-):t foldl lambdabot forall a b. (a -> b -> a) -> a -> [b] -> a gvdm_other > factorial 10 lambdabot Not in scope: `factorial' tsp that made no sense dons > product [1..10] lambdabot 3628800 gvdm_other > fact 10 lambdabot Not in scope: `fact' gvdm_other > 10! lambdabot Parse error gvdm_other :( dons :t product lambdabot forall a. (Num a) => [a] -> a dmwit gvdm_other: If that was built in, what would people give new Haskellers as an exercise? ;-) heatsink :t (+) lambdabot forall a. (Num a) => a -> a -> a tsp I don't get the haskel . syntax as well dons ah well. you'll just have to learn something new :-) heatsink tsp: The (+) operator works on many types, so it uses type variables. Cale tsp: . syntax?(.) is composition of functions heatsink The "forall a." declares that there is one type variable in the type of (+). Cale oh, that dot monochrom It's a punctuation mark. heatsink So if you plug in "Int" for "a", you get (Num Int) => Int -> Int -> Int Cale That's just a separator to indicate where the list of bound variables ends, yeah. dons e.g. \x . x monochrom Most things are punctuation marks. heatsink You can do that?> (\x . x) 3 lambdabot Parse error tsp can python even do a foldl? Cale heatsink: no, but that's the traditional notation for lambda terms tsp just curious kc5tja_ > (\x -> x) 3 Cale tsp: yes, I believe it's called reduce monochrom python can do a foldl lambdabot 3