mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
17 lines
No EOL
400 B
Text
17 lines
No EOL
400 B
Text
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 |