Subject: Re: combination of applications
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 15 Jun 2004 19:26:08 -0500
Newsgroups: comp.lang.lisp
Message-ID: <k5Cdnajr0J89DlLdRVn-jg@speakeasy.net>
Hrvoje Blazevic  <hrvoje@despammed.com> wrote:
+---------------
| > Do a Web search for the terms COMPOSE and/or CURRY. Note that if
| > any of the functions but the last one take more than one argument,
| > you will need to CURRY that function with N-1 arguments before
| > COMPOSE'ing it.
| 
| This is a rather terse information. An easy example should probably help:
+---------------

Except that your example is rather complex. In introductory texts,
the usual definition of CURRY does simple partial application, e.g.:

    > (defun curry (f &rest curried-args)	; sometimes called CURRY-LEFT
	(lambda (&rest args)
	  (apply f (append curried-args args))))
    > (funcall (curry (curry (curry #'+ 17) 12) 51) -42)

    38
    > (funcall (curry #'+ 17 12) 51 -42)	; or more than one at a time

    38
    > 

AFAICT, your CURRY only works for functions of fixed arity, which is
certainly useful in many cases, but can be restrictive at times.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607