From a0e217406bed06e9d774d83fb31b4e648da2c8ec Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Mon, 20 Dec 2010 20:08:57 -0500 Subject: [PATCH] cps tweak Signed-off-by: Jim Pryor --- cps_and_continuation_operators.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cps_and_continuation_operators.mdwn b/cps_and_continuation_operators.mdwn index 32064b9d..e61eb709 100644 --- a/cps_and_continuation_operators.mdwn +++ b/cps_and_continuation_operators.mdwn @@ -94,12 +94,12 @@ Here's another interesting fact about these transforms. Compare the translations [x] --> \k. k x [M N] --> \k. [M] (\m. [N] (\n. m n k)) -To the implementations we proposed for `unit` and `bind` when developing a Continuation monads, for example [here](/list_monad_as_continuation_monad). I'll relabel some of the variable names to help the comparison: +to the implementations we proposed for `unit` and `bind` when developing a Continuation monads, for example [here](/list_monad_as_continuation_monad). I'll relabel some of the variable names to help the comparison: let cont_unit x = fun k -> k x let cont_bind N M = fun k -> N (fun n -> M n k) -The transform for `x` is just `cont_unit x`! And the transform for `M N` is, though not here exactly the same as `cont_bind N M`, quite reminiscent of it. (I don't yet know whether there's an easy and satisfying explanation of why these two diverge as they do.) +The transform for `x` is just `cont_unit x`! And the transform for `M N` is, though not here exactly the same as `cont_bind N M`, quite reminiscent of it. (I don't yet know whether there's an easy and satisfying explanation of why these two are related as they are.) Doing CPS transforms by hand is very cumbersome. (Try it.) But you can leverage our lambda evaluator to help you out. Here's how to do it. From here on out, we'll be working with and extending the call-by-value CPS transform set out above: -- 2.11.0