mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Massive renaming
This commit is contained in:
parent
241ab0a9ae
commit
61296c51e7
152 changed files with 45 additions and 29 deletions
31
regression/test051.lama
Normal file
31
regression/test051.lama
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
local n;
|
||||
|
||||
fun sum (l) {
|
||||
case l of
|
||||
{} -> return 0
|
||||
| h : t -> return (h + sum (t))
|
||||
esac
|
||||
}
|
||||
|
||||
fun print_list (l) {
|
||||
case l of
|
||||
{} -> skip
|
||||
| h : t -> write (h); print_list (t)
|
||||
esac
|
||||
}
|
||||
|
||||
fun array_to_list (a) {
|
||||
local l, i;
|
||||
l := {};
|
||||
for i := a.length, i > 0, i := i-1 do
|
||||
l := a[i-1] : l
|
||||
od;
|
||||
return l
|
||||
}
|
||||
|
||||
n := read ();
|
||||
write (sum ({}));
|
||||
write (sum ({1, 2, 3, 4, 5}));
|
||||
write (sum (1:2:3:4:5:{}));
|
||||
print_list (array_to_list ([1, 2, 3, 4, 5]))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue