X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2Fweek3_lists.mdwn;h=8d646f1713213b644ab01f744f41fc07a0e0df2d;hp=00f1ffde495f6f4bdc92f757392cdf974560fc3c;hb=b93e99adfad61e703393d71f919af78a10b02101;hpb=397f393c83e65a1b34f842d64c2e0eaa7d8246e3 diff --git a/topics/week3_lists.mdwn b/topics/week3_lists.mdwn index 00f1ffde..8d646f17 100644 --- a/topics/week3_lists.mdwn +++ b/topics/week3_lists.mdwn @@ -80,7 +80,9 @@ To translate that, first let's handle the iteration over the final list, that `x This looks like what we had before, except that now we have this free variable `y` in our lambda expression. Perhaps we can bind that variable inside a *larger* lambda expression, and then map (and filter) *that* larger lambda expression over the list that `y` is drawn from: - map (lambda y. map (lambda x. 10*x + y) [1, 2, 3]) $ filter (lambda y. y < 6) [4, 5, 6] + let + f match lambda y. map (lambda x. 10*x + y) [1, 2, 3] + in map f $ filter (lambda y. y < 6) [4, 5, 6] This gives us nearly what we want. It evaluates to: