tweak advanced
authorJim Pryor <profjim@jimpryor.net>
Sun, 3 Oct 2010 06:34:31 +0000 (02:34 -0400)
committerJim Pryor <profjim@jimpryor.net>
Sun, 3 Oct 2010 06:34:31 +0000 (02:34 -0400)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
miscellaneous_lambda_challenges_and_advanced_topics.mdwn

index ea07a84..0342fc6 100644 (file)
@@ -324,7 +324,7 @@ can use.
        This "handler" encodes the search's having finished, and delivering a final
        answer to whatever else you wanted your program to do with the result of the
        search. If you like, at any stage in the search you might just give an argument
-       to this handler, instead of giving an argument to the handler that continues
+       to *this* handler, instead of giving an argument to the handler that continues
        the list traversal leftwards. Semantically, this would amount to *aborting* the
        list traversal! (As we've said before, whether the rest of the list traversal
        really gets evaluated will depend on what evaluation order is in place. But
@@ -339,8 +339,8 @@ can use.
 
                f 3 <result of folding f and z over [2; 1]> <handler to continue folding leftwards> <handler to abort the traversal>
 
-       `f`'s job would be to check whether 3 matches the element we're searching for
-       (here also 3), and if it does, just evaluate to the result of passing `true` to
+       `f`'s job would be to check whether `3` matches the element we're searching for
+       (here also `3`), and if it does, just evaluate to the result of passing `true` to
        the abort handler. If it doesn't, then evaluate to the result of passing
        `false` to the continue-leftwards handler.
 
@@ -355,27 +355,28 @@ can use.
        of the list multiplied to, because that would affect the answer you passed
        along to the continue-leftwards handler.
 
-       A **version 5** list would encode this kind of fold operation over the list, in
+       A **version 5** list encodes the kind of fold operation we're envisaging here, in
        the same way that v3 (and v4) lists encoded the simpler fold operation.
        Roughly, the list `[5;4;3;2;1]` would look like this:
 
 
                \f z continue_leftwards_handler abort_handler.
-                       <fold f and z over [4; 3; 2; 1]>
+                       <fold f and z over [4;3;2;1]>
                        (\result_of_fold_over_4321. f 5 result_of_fold_over_4321  continue_leftwards_handler abort_handler)
                        abort_handler
 
+               ; or, expanding the fold over [4;3;2;1]:
 
                \f z continue_leftwards_handler abort_handler.
                        (\continue_leftwards_handler abort_handler.
-                               <fold f and z over [3; 2; 1]>
+                               <fold f and z over [3;2;1]>
                                (\result_of_fold_over_321. f 4 result_of_fold_over_321 continue_leftwards_handler abort_handler)
                                abort_handler
                        )
                        (\result_of_fold_over_4321. f 5 result_of_fold_over_4321  continue_leftwards_handler abort_handler)
                        abort_handler
 
-               and so on               
+               ; and so on             
                
        Remarks: the `larger_computation_handler` should be supplied as both the
        `continue_leftwards_handler` and the `abort_handler` for the leftmost