Skip to content

Instantly share code, notes, and snippets.

@szastupov
Created December 8, 2009 15:14
Show Gist options
  • Save szastupov/251714 to your computer and use it in GitHub Desktop.
Save szastupov/251714 to your computer and use it in GitHub Desktop.
module Dict =
struct
type 'v t
external create : unit -> 'v t = "$new" "Object"
let add d k v =
Ocamljs.assign (Ocamljs.hashref d k) v
let find d k =
let v = Ocamljs.hashref d k in
if (Javascript.typeof v) = "undefined" then
None
else
Some v
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment