From 3f14ad8bc8bc4e48423e1c2b30b32dd5bd929d2a Mon Sep 17 00:00:00 2001 From: jim Date: Sun, 8 Feb 2015 19:22:57 -0500 Subject: [PATCH 1/1] "inner" expression --- topics/week3_lists.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topics/week3_lists.mdwn b/topics/week3_lists.mdwn index 8d646f17..14663cda 100644 --- a/topics/week3_lists.mdwn +++ b/topics/week3_lists.mdwn @@ -88,7 +88,7 @@ This gives us nearly what we want. It evaluates to: [[14, 24, 34], [15, 25, 35]] -Why? Because the `filter` expression at the end is restricting the domain that `y` ranges over to `[4, 5]`. Over this domain we are selecting a value to bind `y` to, and then evaluating the inner `map` expression with `y` so bound. With `y` bound to `4`, we get the result `[14, 24, 34]`. With `y` bound to `5`, we get the result `[15, 25, 35]`. These two results, in order, are the elements that make up the sequence which is the result of the outermost `map` expression. +Why? Because the `filter` expression at the end is restricting the domain that `y` ranges over to `[4, 5]`. Over this domain we are selecting a value to bind `y` to, and then evaluating the `map` expression inside `f` with `y` so bound. With `y` bound to `4`, we get the result `[14, 24, 34]`. With `y` bound to `5`, we get the result `[15, 25, 35]`. These two results, in order, are the elements that make up the sequence which is the result of the outermost `map` expression. One final twist is that our original list comprehension gives us a "flatter" result. In both Kapulet (and Haskell, modulo a few syntax adjustments), the list comprehension: -- 2.11.0