Intermediate; pattern matching in x86

This commit is contained in:
Dmitry Boulytchev 2018-05-16 09:24:40 +03:00 committed by danyaberezun
parent 2ba7a95f86
commit 9f8391607d
7 changed files with 184 additions and 303 deletions

View file

@ -1,23 +0,0 @@
fun append (x, y) {
case x of
`nil -> return y
| `cons (h, t) -> return `cons (h, append (t, y))
esac
}
fun printList (x) {
case x of
`nil -> skip
| `cons (h, t) -> write (h); printList (t)
esac
}
n := read ();
x := `cons (1, `cons (2, `nil));
y := `cons (3, `cons (4, `nil));
printList (x);
printList (y);
printList (append (x, y));
printList (append (y, x))