mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
19 lines
No EOL
392 B
Text
19 lines
No EOL
392 B
Text
var x, y, i;
|
|
|
|
fun f (x) {
|
|
case x of
|
|
Nil -> write (0)
|
|
| Cons (_, Nil) -> write (1)
|
|
| Cons (_, Cons (_, Nil)) -> write (2)
|
|
| Cons (_, Cons (_, Cons (_, Nil))) -> write (3)
|
|
| _ -> write (4)
|
|
esac
|
|
}
|
|
|
|
x := read ();
|
|
y := Nil;
|
|
|
|
for i := 0, i < 10, i := i + 1 do
|
|
f (y);
|
|
y := Cons (i, y)
|
|
od |