return fixed for real, tests added

This commit is contained in:
Dmitry Boulytchev 2020-01-05 03:33:17 +03:00
parent 644c1b3086
commit 274bda6938
95 changed files with 870 additions and 14 deletions

31
regression/test085.expr Normal file
View file

@ -0,0 +1,31 @@
local n;
fun sum (l) {
case l of
{} -> 0
| h : t -> (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;
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]))