Question: Statements inside functions

It seems rather arbitrary that proc..end proc is allowed inside functions, but none of the other statements from ?index,statement are:

seq(try ln(i) catch: -infinity end try, i=0..2)
seq(proc() try ln(i) catch: -infinity end try end proc(), i=0..2)

Only the second one works, even though syntactically it doesn't seem to be different from the first one.

It would be really convenient to have any statement allowed inside a function, including assignments (as :=, not as assign()) and compound statements:

s:=0: seq(s:=s+i, i=1..10)
s:=0: seq(proc() global s:=s+i end proc(), i=1..10)

This is more compact than using a loop.

Please Wait...