Skip to content

Instantly share code, notes, and snippets.

@Octachron
Created July 4, 2014 12:33
Show Gist options
  • Save Octachron/253d8be9b3cc3b2ea618 to your computer and use it in GitHub Desktop.
Save Octachron/253d8be9b3cc3b2ea618 to your computer and use it in GitHub Desktop.
type (_,_) nuple =
| Z : (unit,unit) nuple
| P: ('a * ('b,'c) nuple) -> ('a, ('b,'c) nuple ) nuple
let p=P(1, P("try", P( [4,5], Z)))
let rec map: 'a 'b 'c 'd 'e 'f. ('a,'b) nuple -> ('c,'d) nuple ->('e,'f) nuple=
fun fs ps -> match (fs,ps ) with
| P(f,fs), P(p,ps) -> P(f p, map fs ps)
| Z, Z -> Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment