On 1/31/07, Andrew Wagner <[EMAIL PROTECTED]> wrote:
So, a couple of questions to ponder about this: Is this unique to
Haskell, or could the same be said about any functional language? How
can we teach this better to newbies? Most of what I see in the
tutorials is "Higher order functions accept
On 31/01/07, Andrew Wagner <[EMAIL PROTECTED]> wrote:
Like I said, I'm familiar with map, foldr, etc. But this is the
first time it's dawned on me that I need to think in more general
recursive patterns like this instead of simple, raw recursion. That
map and foldr aren't JUST a nice way of doi
Hi Andrew,
You wrote:
combine :: [Int] -> [Int] -> [[Int]]
combine [] _ = []
combine (x:xs) ys = (take x ys) : (combine xs (drop x ys))
...A much more experienced haskeller told me he
preferred to write it like this:
combine' :: [Int] -> [Int] -> [[Int]]
combine' xs ys = snd $ mapAccumL aux ys
I won't speak for anyone else, but I remember when recursion first
"clicked". It was in a 400-level data structures and algorithms class.
I had already done a fair amount of chess programming (which of course
does a massive amount of recursion), but it still seemed a bit magical
to me. When the p