Roy Feague
Check me out on the web at Satori Labs, Inc..
| Forum | Thread | Replies | Latest activity |
|---|---|---|---|
| Tech Off | Side-by-side screwup | 34 | Jan 05, 2010 at 9:07 PM |
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
| Forum | Thread | Replies | Latest activity |
|---|---|---|---|
| Tech Off | Side-by-side screwup | 34 | Jan 05, 2010 at 9:07 PM |
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 4 of 13
Oct 26, 2009 at 10:09 PMThanks ShinNoNoir and exoteric.
This is analogous to correlated subqueries in SQL, which also tax my brain.
I guess what I find weird about \x -> (\y -> x+y) is:
1. the syntax suggests to me that the definition of \y is complete within the parentheses, but it has a dependency that reaches outside the parens and raises questions about the limits of scope; and (related)
2. in other programming contexts one learns to read parentheses from innermost to outermost. But here we need to read it left to right.
I guess it's just going to take a while to learn to think like the Haskell parser.
Another example that twists my C/C++ programmer's brain: we can define tail as
mytail (_:xs) = xs
Very logical, but this assumes that the language is able to deconstruct the list input to understand that it can be thought of as a single element added to a list. Cool that the language can do that, but not obvious, and leaves me wondering what other sorts of deconstructions it is capable of making that are not obvious. Can I do drop2 (b:(a:xs)) = b:xs to drop the second item? How will we know the limits of such constructs without just trial and error? I'm sure this will become more clear as we go on.
re: (-1) 3 --- agreed that the problem is that -1 can be read (and apparently IS read) as negative 1. Surprising then that we can't use ((-)1) 3 or something analogous. The flip business seems very convoluted. But I suppose this is a minor syntactic quirk originating from the overloaded use of the - symbol, and since it only impacts a syntax shortcut, it's probably not worth worrying too much about.
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 4 of 13
Oct 25, 2009 at 11:00 PMI am delighted to have found this series. Really great stuff, and it's a real pleasure to have access to such a top-tier instructor. Thanks Erik!
In the function
add = \x -> (\y -> x+y)
how can the inner function \y access the value of x when it is defined to take only a single parameter y?
And why does the expression
(-1) 3
return an error, but
(/2) 6
is fine?
-Roy