Created
September 9, 2020 12:32
-
-
Save iwilare/f0a433d1744685f0c84e927bd03ed46a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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