Hi,


> I was thinking in terms of function projection. Take a
> binary function (like + ), fix one of the arguments
> (5) and create a monadic (?) function that can be
> applied to say a vector. Sorry if all this seems like
> elementary stuff, I'm just starting with REBOL and
> exploring the possibilities.
>

It is not that elementary, but with a help of
http://www.rebol.org/advanced/highfun.r you can do:

block-add-5: mapper (do curry :add 1 5)
>> block-add-5 [1 2 3]
== [6 7 8]

Regards
    Ladislav

> --- [EMAIL PROTECTED] wrote:
> > > Perfect. Just what I needed. Wish there was a way
> > to
> > > make simple one-off functions in a block like [ +
> > 5]
> > > etc.
> > >
> >
> > 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?
> >
> > Brett.
> >
> >
>
>
> =====
>
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
>

Reply via email to