Skip to content

Instantly share code, notes, and snippets.

@luqui
Forked from anonymous/functions.mkd
Created March 7, 2012 02:31
Show Gist options
  • Save luqui/1990511 to your computer and use it in GitHub Desktop.
Save luqui/1990511 to your computer and use it in GitHub Desktop.

x :Y is shorthand for x [Y 'x].

Definition of functions:

A B :*
->
function :*
(f :function x :A -> apply :B)   -- application
((x :A -> y :B) ->               -- abstraction
    f :function
    (x :A -> ['apply(f,x) = 'y(x)]))

Naturals and its constructors.

nat :*
zero :nat
(x :nat -> succ :nat)

A successor function:

succF :function(nat,nat)
(x :nat -> ['apply(nat,nat,succF,x) = 'succ(x)])

But functions are not the typical way of working with stuff in this language, so this is just a proof of modeling power.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment