[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 1.5.0.9 (X11/20070103) |
Hi,
On the page
"http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/define_002a-Reference.html",
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)
7
guile>(define add2 (a 2))
guile>(add2 -15)
-13
This looks quite nice. However, the section on Guile's define
("http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Lambda-Alternatives.html")
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
<http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Lambda.html#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:
@lisp
(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.
Regards,
Jon
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- manual change suggestion,
Jon Wilson <=