Commits

Yaron Minsky  committed 2d4b355

added side_pair implementation

  • Participants
  • Parent commits 99f58d9

Comments (0)

Files changed (2)

File ocaml/Makefile

-all: experiments.native permutation.cmo iet.cmo
+all: experiments.native permutation.cmo iet.cmo side_pair.cmo
 
 FORCE:
 	true

File ocaml/side_pair.ml

+open Core.Std
+
+type 'a t = { top: 'a; bot: 'a } with sexp
+
+let get t side = 
+  match (side : Side.t) with Top -> t.top | Bot -> t.bot
+
+let set t side x =
+  match (side : Side.t) with
+  | Top -> { t with top = x }
+  | Bot -> { t with bot = x }
+
+let of_fn (f : Side.t -> 'a) =
+  { top = f Top
+  ; bot = f Bot
+  }