Message from discussion
Associativity paradox in functional expressions
Received: by 10.224.223.14 with SMTP id ii14mr19337772qab.3.1351704844677;
Wed, 31 Oct 2012 10:34:04 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.143.241 with SMTP id l77mr3762173yhj.10.1351704844648;
Wed, 31 Oct 2012 10:34:04 -0700 (PDT)
Path: gf5ni7629245qab.0!nntp.google.com!c7no1019636qap.0!postnews.google.com!3g2000yqn.googlegroups.com!not-for-mail
Newsgroups: comp.lang.functional,comp.lang.lisp,comp.lang.scheme,comp.programming,comp.emacs
Date: Wed, 31 Oct 2012 10:34:04 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: 3g2000yqn.googlegroups.com; posting-host=99.113.165.141; posting-account=jIN2TAoAAADwVIioKALYoEXCqr-xwnfd
NNTP-Posting-Host: 99.113.165.141
References: <8120f97b-15c2-4ce8-827a-158e955fb73f@z2g2000yqj.googlegroups.com>
<9972e570-2504-4401-8de8-49eb1929fdfd@c17g2000yqe.googlegroups.com> <see-40D521.21142131102012@news.eternal-september.org>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0,gzip(gfe)
Message-ID: <9418c34c-3f48-4393-8ab2-e8a30d544998@3g2000yqn.googlegroups.com>
Subject: Re: Associativity paradox in functional expressions
From: Totaram Sanadhya <swami.totaram.sanad...@gmail.com>
Injection-Date: Wed, 31 Oct 2012 17:34:04 +0000
Content-Type: text/plain; charset=ISO-8859-1
On Oct 31, 1:14 am, Barb Knox <s...@sig.below> wrote:
> In article
> <9972e570-2504-4401-8de8-49eb1929f...@c17g2000yqe.googlegroups.com>,
> Totaram Sanadhya <swami.totaram.sanad...@gmail.com> wrote:
>
> > Hi,
>
> > My main functional language is emacs based lisp.
>
> > I am not exactly clear about the associativity.
>
> > On the one hand the elements of a list such as (a b c d) are right
> > associative
>
> > (cons 'a (cons 'b (cons 'c (cons 'd nil)))) C-x C-e
>
> > ==> (a b c d)
>
> > On the other hand a curried function such as (f x y z) is left
> > associative by definition
>
> > (...(f x) y) z)
>
> > How do you resolve this paradox?
>
> Easily: Lisp does not use curried functions.
Which programming languages use curried functions?
I have often heard people like Kastrup talk of
curried functions in gnu.emacs.help and they
even give some code like
((lambda(g n) (funcall g g n))
(lambda(f n)
(if (zerop n) 1
(* n (funcall f f (1- n)))))
4 )
Is there some kind of hack by which I could come close to it in emacs
lisp?
I would have gladly put a backtrace or execution trace for you, but I
could not find a single function that gives an output like the
detailed backtrace when there is an execution error. Perhaps, someone
who is more knowledgeable can take this as an _aside_ question.
However, before I end my post, I just want to thank both Barb and
especially Nils for his student-friendly writings, and the wonderful
books he has written.
Swami
P.S. Unfortunately, I have to crosspost as this is relevant in many
groups, so please avoid or ignore any flames or derailing attempts.