[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

manual change suggestion

From: Jon Wilson
Subject: manual change suggestion
Date: Mon, 08 Jan 2007 16:14:29 -0600
User-agent: Thunderbird (X11/20070103)

On the page "";, in the first paragraph describing define* and define*-public, we have the following:

They also support arbitrary-depth currying, just like Guile's define.

I found this very interesting, as I did not know that Guile's define supported arbitrary-depth currying. But, sure enough, it does:

guile>(define ((a b) c)  (+ b c))
guile>(a 2)
#<procedure #f (c)>
guile>((a 2) 5)
guile>(define add2 (a 2))
guile>(add2 -15)

This looks quite nice. However, the section on Guile's define ("";) does not mention this anywhere. In fact, the only place currying is mentioned at all is on the define* page. This feature ought to be found on the Lambda Alternatives page.

I propose, following "For details on how these forms work, see See Lambda <>." (perhaps that doubled "see See" ought to be looked at) :

---------begin proposed manual addition ----------
The @code{define} form can also be used to create and bind to a variable curried functions, to an arbitrary depth. A curried function is one which takes some of its arguments and returns a new function which has those values bound up in the closure, and now takes the remaining (or some of the remaining) arguments. For example:

(define ((curried-subtract n1) n2)
 (- n1 n2))

(curried-subtract 2)        @result{} #<procedure #f (n2)>

((curried-subtract 2) 5)   @result{} -3
@end lisp
---------  end manual proposed addition ----------

Of course, I don't know texinfo, so I'm just going by imitation, and I whipped this up out of my head in less than 5 minutes, so I'm sure it could stand some improvement. But it is a start.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]