* manual change suggestion
@ 2007-01-08 22:14 Jon Wilson
0 siblings, 0 replies; only message in thread
From: Jon Wilson @ 2007-01-08 22:14 UTC (permalink / raw)
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
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-01-08 22:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-08 22:14 manual change suggestion Jon Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).