
15 Aug
2007
15 Aug
'07
1:58 p.m.
On Wed, 2007-08-15 at 10:50 -0700, Stefan O'Rear wrote:
OTOH, your proposal provides (IMO) much more natural syntax for multi-pattern anonymous functions, especially if we stipulate that unlike a case (but like a lambda) you can have multiple arguments; then you could write stuff like:
sumTo0 = foldr (\of 0 k -> 0 n k -> n + k) 0
Anyone else like this?
Why not just: sumTo0 = foldr (\0 k -> 0 n k -> n + k) 0 I find using "case" or "of" for multiple arg lambda pattern matches odd since "case foo of" is only used for single arg pattern matches. I suppose the equivalent explicit layout syntax would be: sumTo0 = foldr (\{ 0 k -> 0; n k -> n + k }) 0 Duncan