Skip to content

Commit

Permalink
added missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
pikatchu committed Jun 28, 2011
1 parent 257ce6d commit 3170887
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions stdlib/closure.lml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

module Closure = struct

type ('a, 'b) t =
{ env: _;
f: _ * 'a -> _ * 'b ;
g: _ -> unit;
}

val make: ('a * 'b -> 'a * 'c) * 'a * ('a -> unit) -> ('b, 'c) t
let make f env g = { ~env; ~f; ~g }

val call: ('a, 'b) t * 'a -> ('a, 'b) t * 'b
let call f x =
let { f; ~env } = f in
let env, res = f.f env x in
{ f with ~env }, res

val release: ('a, 'b) t -> unit
let release t =
let {t; ~env} = t in
t.g env;
free t

end
6 changes: 6 additions & 0 deletions stdlib/option.lml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Option = struct

type 'a t =
| None
| Some of 'a
end

0 comments on commit 3170887

Please sign in to comment.