16 lines
706 B
Text
16 lines
706 B
Text
// zero increment (ie infnite loop) throws an error
|
|
// if stop is "*", the loop is has no end (ie infinite)
|
|
// stop is included unless step steps skips it
|
|
// if start > stop is a dead loop
|
|
// ranges ([a..b,c]) are lazy lists
|
|
fcn looper([(start,stop,increment)]){
|
|
print(" %3s %3s\t%2d --> ".fmt(start,stop,increment));
|
|
try{ foreach n in ([start..stop,increment]){ print(n," ") } }
|
|
catch{ print(__exception) }
|
|
println();
|
|
}
|
|
println("start stop increment");
|
|
T( T(-2,2,1),T(-2,2,0),T(-2,2,-1),T(-2,2,10),T( 2,-2,1),
|
|
T( 2,2,1),T( 2,2,-1),T( 2,2,0),T( 0,0,0),
|
|
T(0.0, (0.0).pi, 0.7853981633974483), T("a","e",1), T("e","a",1) )
|
|
.apply2(looper); // apply2 is apply (map) without saving results
|