From: ··················@gmail.com
Subject: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173994689.939189.215290@d57g2000hsg.googlegroups.com>
Hi,

I've just started using Lisp a few weeks ago, and I haven't seen any
built-in function to curry another function. I have had a brief look
at the Hyperspec but I couldn't find anything.

That's obviously possible, so is there any standard function defined
for that purpose in Common Lisp?

Thanks in advance.

From: Kaz Kylheku
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173996970.870056.313630@d57g2000hsg.googlegroups.com>
On Mar 15, 1:38 pm, ··················@gmail.com wrote:
> Hi,
>
> I've just started using Lisp a few weeks ago, and I haven't seen any
> built-in function to curry another function.

The LAMBDA operator creates a lexical closure. If F is a function of
two arguments, and A is some value that is to be used as the first
argument, then LAMBDA can be used to curry to a one-argument function
as follows:

  (lambda (x) (funcall f a x))

If F is the name of a function rather than an expression that
evaluates to a function object, drop the funcall.
From: Vagif Verdi
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173997424.990644.232710@y80g2000hsf.googlegroups.com>
Arnesi library has CURRY function.

http://common-lisp.net/project/bese/docs/arnesi/html/api/function_005FIT.BESE.ARNESI_003A_003ACURRY.html
From: ··@codeartist.org
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173998788.302861.120360@o5g2000hsb.googlegroups.com>
On 15 Mrz., 22:38, ··················@gmail.com wrote:
> Hi,
>
> I've just started using Lisp a few weeks ago, and I haven't seen any
> built-in function to curry another function. I have had a brief look
> at the Hyperspec but I couldn't find anything.
>
> That's obviously possible, so is there any standard function defined
> for that purpose in Common Lisp?
>
> Thanks in advance.

There is no predefined CURRY in ANSI Common Lisp. Defining your own
CURRY is quite straightforward though. If you want it to be efficient,
you can augment it by a compiler macro that curries at compile-time.

ciao,
Jochen
From: ··················@gmail.com
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173999237.323484.64550@d57g2000hsg.googlegroups.com>
On 15 mar, 23:46, ·····@codeartist.org" <····@codeartist.org> wrote:
> On 15 Mrz., 22:38, ··················@gmail.com wrote:
>
> > Hi,
>
> > I've just started using Lisp a few weeks ago, and I haven't seen any
> > built-in function to curry another function. I have had a brief look
> > at the Hyperspec but I couldn't find anything.
>
> > That's obviously possible, so is there any standard function defined
> > for that purpose in Common Lisp?
>
> > Thanks in advance.
>
> There is no predefined CURRY in ANSI Common Lisp. Defining your own
> CURRY is quite straightforward though. If you want it to be efficient,
> you can augment it by a compiler macro that curries at compile-time.
>
> ciao,
> Jochen

Yeah, that was what I was thinking about: coding a macro. However I
wanted to know if there was a standard solution beforehand.

Thank you all.
From: Edi Weitz
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <uhcsmnlsh.fsf@agharta.de>
On 15 Mar 2007 15:53:57 -0700, ··················@gmail.com wrote:

> On 15 mar, 23:46, ·····@codeartist.org" <····@codeartist.org> wrote:
>
>> There is no predefined CURRY in ANSI Common Lisp. Defining your own
>> CURRY is quite straightforward though. If you want it to be
>> efficient, you can augment it by a compiler macro that curries at
>> compile-time.
>
> Yeah, that was what I was thinking about: coding a macro.

No, you don't want a macro, you want a function.  A compiler macro is
not the same as a macro.  See for example here:

  http://www.pentaside.org/paper/compilermacro-lemmens/compiler-macros-for-publication.txt

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Alexander Schmolck
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <yfs3b46qhze.fsf@oc.ex.ac.uk>
··················@gmail.com writes:

> Hi,
> 
> I've just started using Lisp a few weeks ago, and I haven't seen any
> built-in function to curry another function. I have had a brief look
> at the Hyperspec but I couldn't find anything.
> 
> That's obviously possible, so is there any standard function defined
> for that purpose in Common Lisp?

No.

'as
From: ··················@gmail.com
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173996534.303670.30680@l75g2000hse.googlegroups.com>
On 15 mar, 23:06, Alexander Schmolck <··········@gmail.com> wrote:
> ··················@gmail.com writes:
> > Hi,
>
> > I've just started using Lisp a few weeks ago, and I haven't seen any
> > built-in function to curry another function. I have had a brief look
> > at the Hyperspec but I couldn't find anything.
>
> > That's obviously possible, so is there any standard function defined
> > for that purpose in Common Lisp?
>
> No.
>
> 'as

So do I have to code it by hand???
From: Kaz Kylheku
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <1173996822.686340.207030@y80g2000hsf.googlegroups.com>
On Mar 15, 2:08 pm, ··················@gmail.com wrote:
> So do I have to code it by hand???

Well, you have to add something into your program so that the computer
knows about your intent to curry a function. For people with
disabilities, there exist special input methods for doing that, but by
most of the programming population, it's done with the hands.
From: Edi Weitz
Subject: Re: Currying in Lisp - Suggestions for a beginner
Date: 
Message-ID: <utzwmno0n.fsf@agharta.de>
On 15 Mar 2007 15:08:54 -0700, ··················@gmail.com wrote:

> So do I have to code it by hand???

You can copy it somewhere.  Here for example:

  http://common-lisp.net/project/alexandria/darcs/alexandria/functions.lisp

Not sure if you need your hands for that...

-- 

Lisp is not dead, it just smells funny.

Real email: (replace (subseq ·········@agharta.de" 5) "edi")