Jonathan S. Shapiro wrote:
> 1. I am having difficulty coming up with a sensible syntax for loops.
> The statement-style syntax doesn't seem to lend itself to a functional
> (non-stateful) loop idiom. I would appreciate suggestions on this.
I think we can have a construct similar to the standard for loop:
initialie ; condition ; step ; return
for(i=<init1>, j=<init2>, ... ; <cond> ; i = <step1>, ...; <ret-value>){
}
All of the i, j, ... initializations create new bindings. The step
expressions "assign" new values (execute with new bindings) to these
variables in subsequent executions of the loop. Whenever the condition
<cond> fails, the for-loop returns the value specified in the fourth
<return> component.
We can make some convenience assumptions such as if a variable `i' is
not re-initialized in the step portion, the corresponding step is
understood as i = i. Notice that this is not assignment (:=) but written
as initialization (=). We can also say that for-loops return unit, and
not require the return component.
Swaroop.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev