Skip to content

Instantly share code, notes, and snippets.

@iwilare
Created September 9, 2020 12:32
Show Gist options
  • Save iwilare/f0a433d1744685f0c84e927bd03ed46a to your computer and use it in GitHub Desktop.
Save iwilare/f0a433d1744685f0c84e927bd03ed46a to your computer and use it in GitHub Desktop.
data Lam
= Abs Lam
| App Lam Lam
| Var Int
data Stack = S [(Lam, Stack)]
krivine (App a b, S e, S s) = krivine (a, S e, S ((b, S e):s))
krivine (Abs t, S e, S (c:s)) = krivine (t, S (c:e), S s)
krivine (Var n, S e, S s) = krivine (fst (e !! n), snd (e !! n), S s)
krivine (t, S e, S []) = t
eval t = krivine (t, S [], S [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment