number of parameters could be specified when defining a function, but i think this would require a significant change in parsing engine… so likely not that feasible.
the easiest is probably having a fixed number of parameters (one or two), or just using other variables. using this example:
#DEC
X SUB X 1
BREAK
if you want to run this function on variable A you would have to call it like this: X A; F #DEC
what i don’t like about this approach is that you are losing a variable, and unless you use same variables all the time you’d need to remember which variables were used in which function.
for return i don’t think we need to do anything, consider:
#DEC
SUB X 1
BREAK
called like this: X A; A F #DEC
if we were to use a fixed number of parameters, say, two, it could look like this:
#DEC
SUB P1 1
BREAK
which would make for a more elegant A #DEC A 0 (using 0 as a 2nd parameter since it expects two).
also, do we need F when calling a function? we do need to distinguish between when a function is defined vs when it’s called (since functions could call other functions), we could do that by adding : in definition:
#MIN:
IF LT P1 P2: P1
ELSE: P2
BREAK
Z #MIN X Y