FOR and MAP Treating BLOCK! As Dialect By Default

I've been thinking that the natural behavior of things like FOR should be to interpret the data as a dialect.

Hence:

for 'x [1 thru 3] [
   print [x]
]

Gives you:

1
2
3

But if you said:

for 'x each [1 thru 3] [
   print [x]
]

1
thru
3

In that case, EACH is making a generator function, so the second argument to FOR is an ACTION! that produces values until it produces a "done" signal (ERROR! antiform) which causes it to stop the FOR.

Can that resolve that the base level of FOR and MAP is a dialect for generating values?

2 Likes