Skip to content

Instantly share code, notes, and snippets.

@Glorp
Created December 8, 2013 21:49
Show Gist options
  • Save Glorp/7864252 to your computer and use it in GitHub Desktop.
Save Glorp/7864252 to your computer and use it in GitHub Desktop.
datatype nat = z | s of nat
fun fold _ zv z = zv
| fold sf zv (s n) = sf (fold sf zv n)
fun pz _ = z
fun ps g h = h (g s)
fun id x = x
fun p n = (fold ps pz n) id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment