On Wed, Feb 08, 2017 at 06:37:17PM +0100, pd wrote:
> Picolisp curry function does not follow the pattern, its domain is
> completely different and also its image. In other words, you call classical
> curry passing it a function argument but you call picolisp curry passing it
> several arguments to replace certain symbols inside expressions. It's a
> different kind of animal ;-)

Right. Actually, it does not necessarily *replace* certain symbols inside
expressions. It does so only if you pass "pattern variables", see
http://software-lab.de/doc/refP.html#pat?

In the normal, general, case, an environment using 'job' is built. This is
called a "closure" is in statically binding systems. I did not want to call the
PicoLisp 'curry' function a closure, because it returns a *function* while a
closure is not a function but the combination of a piece of code with an
environmennt (i.e. a 'job' in PicoLisp).



> The classical curry in picolisp is what Alex has defined a few emails
> before ;-)

I never saw a use for the classical curry, so I (ab)used this catchy name :)

Can you give an example where it is useful in PicoLisp?


> >    ((X) '((Y) (+ X Y)))
> ... 
> The reason for this expression being completely useless in picolisp *I
> think* is the use of quote as an alias for lambda thus in practise
> protecting them from evaluation and binding

This is not the reason. Quote and lambda are abselutely equivalent here.

You could do

   (setq lambda quote)

and then

      ((X) (lambda (Y) (+ X Y)))

and have the same result, i.e. a function returning ((Y) (+ X Y)), which is a
correct, legal PicoLisp function accepting an single parameter Y and returning a
sum. The quote (or lambda) is gone immediately when returning this function.

It may seem useless to you because PicoLisp uses dynamic binding (X is evaluated
when this function *runs*), but you expected static binding (X is bound to the
value from the environment when this function is *built*).

The latter is done in the 'classiCurry' example in my last mail using the
PioLisp 'curry'.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to