Skip to content

Instantly share code, notes, and snippets.

@Octachron
Last active September 29, 2017 13:59
Show Gist options
  • Save Octachron/05eb7b1ccead65fb1cada5c03cc40dd2 to your computer and use it in GitHub Desktop.
Save Octachron/05eb7b1ccead65fb1cada5c03cc40dd2 to your computer and use it in GitHub Desktop.
type 'a succ = private S
type z = private Z
type ('elt,'size) t =
| []: ('elt, z) t
| (::): 'elt * ('elt,'size) t -> ('elt, 'size succ) t
let rec map2: type size. ('elt -> 'elt2 -> 'elt3) -> ('elt,size) t -> ('elt2,size) t -> ('elt3,size) t = fun f x y ->
match x,y with
| a :: q, b :: q' -> (f a b) :: map2 f q q'
| [], [] -> []
| _ -> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment