X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=assignment1.mdwn;h=ea8f2511992e97ff0caed2f8f002426dd2bc053b;hp=8ecb3f8e5f8ea333d41c1804ca8b4e01c6a5d5a4;hb=513394b4086fc02f9f8214c52d3e8bbaa9cdfd27;hpb=4febe9baf554aef6538d3025e5099a870ca82230 diff --git a/assignment1.mdwn b/assignment1.mdwn index 8ecb3f8e..ea8f2511 100644 --- a/assignment1.mdwn +++ b/assignment1.mdwn @@ -96,11 +96,11 @@ * Write a function `unmap2` that is something like the inverse of `map2`. This function expects two arguments, the second being a sequence of elements of some type *t*. The first is a function `g` that expects a single argument of type *t* and returns a *pair* of results, rather than just one result. We want to collate these results, the first into one list, and the second into a different list. Then `unmap2` should return those two lists. Thus if: - g x1 # evaluates to [y1, z1] - g x2 # evaluates to [y2, z2] - g x3 # evaluates to [y3, z3] + g z1 # evaluates to [x1, y1] + g z2 # evaluates to [x2, y2] + g z3 # evaluates to [x3, y3] - Then `unmap2 (g, [x1, x2, x3])` should evaluate to `([y1, y2, y3], [z1, z2, z3])`. + Then `unmap2 (g, [z1, z2, z3])` should evaluate to `([x1, x2, x3], [y1, y2, y3])`. * Write a function `takewhile` that expects a `p` argument like `filter`, and also a sequence. The result should behave like this: