Return expression eliminated

This commit is contained in:
Dmitry Boulytchev 2021-01-31 19:11:03 +03:00
parent 7eb3e223b8
commit 297139c72a
114 changed files with 37 additions and 1018 deletions

View file

@ -1,5 +1,5 @@
fun f (x) {
return fun (y) {return x + y}
fun (y) {x + y}
}
write (compare (1, 2));

View file

@ -1,10 +1,10 @@
fun insert (tree, value) {
case tree of
Empty -> return Node (value, Empty, Empty)
Empty -> Node (value, Empty, Empty)
| Node (x, left, right) ->
if x > value
then return Node (x, insert (left, value), right)
else return Node (x, left, insert (right, value))
then Node (x, insert (left, value), right)
else Node (x, left, insert (right, value))
fi
esac
}

View file

@ -2,18 +2,18 @@ fun collect_ints_acc (v, tail) {
local i;
case v of
a@#unboxed -> return Cons (a, tail)
| #string -> return tail
a@#unboxed -> Cons (a, tail)
| #string -> tail
| _ ->
for i := 0, i < v.length, i := i + 1 do
tail := collect_ints_acc (v[i], tail)
od;
return tail
tail
esac
}
fun collect_ints (v) {
return collect_ints_acc (v, Nil)
collect_ints_acc (v, Nil)
}
case 1 of

View file

@ -1,12 +1,12 @@
fun hd (l) {
case l of
h : _ -> return h
h : _ -> h
esac
}
fun tl (l) {
case l of
_ : t -> return t
_ : t -> t
esac
}