[REBOL] APL'ish operations Re:(3)
From: bhandley:zip:au at: 26-Jul-2000 10:43
> Perfect. Just what I needed. Wish there was a way to
> make simple one-off functions in a block like [ + 5]
I think you can. Again according to what you need. This is where Rebol
shines. Rebol gives you the ability to interpret blocks (and strings) in way
other than the default provided by Rebol. That is, according to your own
grammar. Rebol calls this a dialect. Admittedly this is not straight-forward
when you're beginning with Rebol. On the other-hand once you have done this
a few times, you will see opportunities for it everywhere and discover that
it really is not as complex as it sounds.
One way to achieve this is to interpret a block by stepping through it and
checking types then doing something. Another way is to use the parse
function of rebol. Parse takes a string or a block as input plus a grammar
specification that will interpret your input according to rules.
So to your example.
What would [+ 5] actually do and how would it be used?