Skip to content
Browse files

added missing files

  • Loading branch information...
1 parent 257ce6d commit 317088765d7d555c426ff8843ec3129b37703408 @pikatchu committed Jun 27, 2011
Showing with 31 additions and 0 deletions.
  1. +25 −0 stdlib/closure.lml
  2. +6 −0 stdlib/option.lml
View
25 stdlib/closure.lml
@@ -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
View
6 stdlib/option.lml
@@ -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.
Something went wrong with that request. Please try again.