mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
12 lines
No EOL
219 B
Text
12 lines
No EOL
219 B
Text
fun sum (x) {
|
|
case x of
|
|
`nil -> return 0
|
|
| `cons (x, tl) -> return x + sum (tl)
|
|
esac
|
|
}
|
|
|
|
x := read ();
|
|
|
|
write (sum (`nil));
|
|
write (sum (`cons (100, `nil)));
|
|
write (sum (`cons (100, `cons (200, `nil)))) |