The first two have been fixed, the third hasn't yet. I'll need to add that implied return statement or some workaround that detects it was hit and change behaviors.
But the target example code has been reached, so yield is now considered functional (if yet in need of polish). Behold, a simple Fibonacci program:
public yields<int> fib(){ local int a = 0; local int b = 1; local int c; yield(a); yield(b); while(c < 100){ c = a + b; yield(c); a = b; b = c; } return();}public static void main(){ foreach(int i in fib()){ print i " "; }}
The next test I think will involve making a functional language style take. That will involve testing yield generators with parameters, and phrase style yields. Eventually I want something like
foreach( int i in take 5 from the Fibonacci Sequence ){ ... }
to do what it means (possibly replacing 'take' with something more descriptive).