git @ Cat's Eye Technologies
Add another example source, 2 test cases, minor edits to README. Chris Pressey 4 years ago
3 changed file(s) with 14 addition(s) and 3 deletion(s).
 146 146 147 147 There is also an operator `;` which appends one list (the right-hand 148 148 side) onto the end of another list (the left-hand side.) This is 149 probably not strictly necessary, since as we'll see later can probably 149 probably not strictly necessary, since as we'll see later we can probably 150 150 build something equivalent using `foreach`es and macros, but what the 151 151 hell, we can afford it. Party down. 152 152 167 167 operator. The value that the body evaluates to is used as the 168 168 accumulator for the next time the body is evaluated, on the next value 169 169 in the data structure. The value that `foreach` evaluates to is the 170 value of the FINAL accumulator (emphasis mine.) The full form of this 170 value of the **final** accumulator (emphasis mine.) The full form of this 171 171 operator is as follows: 172 172 173 173 foreach \$var\$ = data-expr with \$acc\$ = initial-expr be loop-expr else be otherwise-expr 179 179 (sub)list, `foreach` will begin traversing that (sub)list (with the 180 180 same body and current accumulator, natch) instead of passing the 181 181 (sub)list to the body; and 182 - *abortable*, meaning that the loop-expr may evaluate to a special 182 - *abortable*, meaning that the *loop-expr* may evaluate to a special 183 183 value `abort`, which causes traversal of the current (sub)list to 184 184 cease immediately, returning to the traversal of the containing 185 185 list, if any.
 0 foreach \$x\$ = [10, 20, 40] 1 with \$a\$ = ,0,0, be 2 ,+<\$a\$<0<+1+,+>\$a\$>0>+\$x\$+, 3 else be 4 null
 51 51 52 52 | >1>null> 53 53 = Null 54 55 | <,1,2,,1,2,>null> 59 = Int 2 54 60 55 61 | ,1,,2,3,, 56 62 = Cons (Int 1) (Cons (Int 2) (Int 3))