-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type 'a t = (Syntax.id * 'a) list | ||
|
||
exception Not_bound | ||
exception Bound_Several_Times of string | ||
|
||
let empty = [] | ||
let extend x v env = (x,v)::env | ||
|
||
let lookup x env = | ||
try List.assoc x env with Not_found -> raise Not_bound | ||
|
||
let rec map f = function | ||
[] -> [] | ||
| (id, v)::rest -> (id, f v) :: map f rest | ||
|
||
let rec fold_right f env a = | ||
match env with | ||
[] -> a | ||
| (_, v)::rest -> f v (fold_right f rest a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
type 'a t | ||
|
||
exception Not_bound | ||
exception Bound_Several_Times of string | ||
|
||
val empty : 'a t | ||
val extend : Syntax.id -> 'a -> 'a t -> 'a t | ||
val lookup : Syntax.id -> 'a t -> 'a | ||
val map : ('a -> 'b) -> 'a t -> 'b t | ||
val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters