projects
/
lambda.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
commentary on ass6 solutions: post to new_stuff
[lambda.git]
/
week9.mdwn
diff --git
a/week9.mdwn
b/week9.mdwn
index
546b2d2
..
c6dd9e8
100644
(file)
--- a/
week9.mdwn
+++ b/
week9.mdwn
@@
-446,9
+446,9
@@
Here's the implementation of the State monad, together with an implementation of
(* alternatively, an env could be implemented as type char -> int *)
type 'a reader = env -> 'a;;
(* alternatively, an env could be implemented as type char -> int *)
type 'a reader = env -> 'a;;
- let
unit_reader
(value : 'a) : 'a reader =
+ let
reader_unit
(value : 'a) : 'a reader =
fun e -> value;;
fun e -> value;;
- let
bind_reader
(u : 'a reader) (f : 'a -> 'b reader) : 'b reader =
+ let
reader_bind
(u : 'a reader) (f : 'a -> 'b reader) : 'b reader =
fun e -> let a = u e
in let u' = f a
in u' e;;
fun e -> let a = u e
in let u' = f a
in u' e;;
@@
-458,9
+458,9
@@
Here's the implementation of the State monad, together with an implementation of
(* this corresponds to having only a single mutable variable *)
type 'a state = store -> ('a, store);;
(* this corresponds to having only a single mutable variable *)
type 'a state = store -> ('a, store);;
- let
unit_state
(value : 'a) : 'a state =
+ let
state_unit
(value : 'a) : 'a state =
fun s -> (value, s);;
fun s -> (value, s);;
- let
bind_state
(u : 'a state) (f : 'a -> 'b state) : 'b state =
+ let
state_bind
(u : 'a state) (f : 'a -> 'b state) : 'b state =
fun s -> let (a, s') = u s
in let u' = f a
in u' s';;
fun s -> let (a, s') = u s
in let u' = f a
in u' s';;