From 16d60ccef54c35bf297e46ed0862da0bcd6fa475 Mon Sep 17 00:00:00 2001 From: Jim Pryor Date: Tue, 2 Nov 2010 22:41:49 -0400 Subject: [PATCH] assign6 tweaks Signed-off-by: Jim Pryor --- assignment6.mdwn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/assignment6.mdwn b/assignment6.mdwn index 7a2bb0f1..30763c1a 100644 --- a/assignment6.mdwn +++ b/assignment6.mdwn @@ -4,15 +4,15 @@ returning a simple integer as a result, it will deliver the correct answer along with a count of the number of operations performed during the calculation. That is, the desired behavior should be like this: - # lift ( + ) (lift ( / ) (unit 20) (unit 2)) - (lift ( * ) (unit 2) (unit 3)) 0;; + # lift2 ( + ) (lift2 ( / ) (unit 20) (unit 2)) + (lift2 ( * ) (unit 2) (unit 3)) 0;; - : int * int = (16, 3) - Here, `lift` is the function that uses `bind` to prepare an ordinary + Here, `lift2` is the function that uses `bind` to prepare an ordinary arithmetic operator (such as addition `( + )`, division `( / )`, or multiplication `( * )`) to recieve objects from the counting monad as arguments. The response of the interpreter says two things: that -(20/2) + (2*3) = 16, and that the computation took three arithmetic +(20/2) + (2\*3) = 16, and that the computation took three arithmetic steps. By the way, that zero at the end provides the monadic object with a starting point (0 relevant computations have occurred previous to the current computation). @@ -21,7 +21,7 @@ to the current computation). divide by zero (so there should be no int option types anywhere in your solution). - You'll need to define a computation monad type, unit, bind, and lift. + You'll need to define a computation monad type, unit, bind, and lift2. We encourage you to consider this hint: [[hints/Assignment 6 Hint 1]]. 2. Prove that your monad satisfies the monad laws. First, give -- 2.11.0