lama_byterun/regression/test038.expr

24 lines
405 B
Text
Raw Normal View History

2018-05-16 16:50:36 +03:00
fun append (x, y) {
case x of
2019-03-07 19:06:04 +03:00
Nil -> return y
| Cons (h, t) -> return Cons (h, append (t, y))
2018-05-16 16:50:36 +03:00
esac
}
fun printList (x) {
case x of
2019-03-07 19:06:04 +03:00
Nil -> skip
| Cons (h, t) -> write (h); printList (t)
2018-05-16 16:50:36 +03:00
esac
}
n := read ();
2019-03-07 19:06:04 +03:00
x := Cons (1, Cons (2, Nil));
y := Cons (3, Cons (4, Nil));
2018-05-16 16:50:36 +03:00
printList (x);
printList (y);
printList (append (x, y));
printList (append (y, x))