I'm new to OZ Mozart, I'm trying to write a triangular sequence but the programming won't work.
declare
fun {Sequence N R}
fun {Help I}
if I < N
sum = {Int.toFloat(N*(N+1)/2.0)}
%I + 1
case R of nil then {Append [sum] nil}
[] H|T then sum|H|T
end
I+1
end
end
in
{Help 0}
end
declare
{Browse {Sequence 5 nil}}
If there anything wrong with my programming? It shows error like:
%*************************** parse error ************************
%**
%** syntax error, unexpected T_end, expecting T_then
%**
%** in file "c:/Users/admin/Desktop/test (2).oz", line 11, column 6
%** ------------------ rejected (1 error)
Any idea about that? Thank you