From: Ranco Marcus
Subject: fixed point in evaluation
Date: 
Message-ID: <ED%g8.66534$Wm3.3618878@zwoll1.home.nl>
Hi,

I was wondering, when a Lisp interpreter is evaluating its expressions, what
criteria is used to tell the interpreter that eval should stop. After all,
after a certain amount of evaluations the resulting expression is in normal
form.
Does the interpreter use a predicate for this (like normalp) or does it have
something to do with the fixed point?
Does a Lisp programmer have access to this, say, predicate?

Thanks,

Ranco Marcus

From: Marco Antoniotti
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <y6c4rjvj9rj.fsf@octagon.mrl.nyu.edu>
Hi

"Ranco Marcus" <·······@wish.nl> writes:

> Hi,
> 
> I was wondering, when a Lisp interpreter is evaluating its expressions, what
> criteria is used to tell the interpreter that eval should stop. After all,
> after a certain amount of evaluations the resulting expression is in normal
> form.

I think you first need to understand what are "le objets de discours"
(pardon - and correct - my French).

(Common) Lisp is a general programming language. Its roots are in a
Lambda Calculus, but the evaluations that take place in a (interpreted
or compiled) (Common) Lisp program are not necessarily mirrored in the
formal "reductions" of a theoretical Lambda Calculus "system".

> Does the interpreter use a predicate for this (like normalp) or does it have
> something to do with the fixed point?
> Does a Lisp programmer have access to this, say, predicate?

Not in the standard, for the resons I gave beforehand.  But (Common)
Lisp makes it extremely easy to write your own Lambda Calculus
subsystem and to play around with it.

Hope this helps.

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.
From: Barry Margolin
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <Y_6h8.3$pc1.182@paloalto-snr1.gtei.net>
In article <·······················@zwoll1.home.nl>,
Ranco Marcus <·······@wish.nl> wrote:
>I was wondering, when a Lisp interpreter is evaluating its expressions, what
>criteria is used to tell the interpreter that eval should stop. After all,
>after a certain amount of evaluations the resulting expression is in normal
>form.

There is no repeated evaluation.  Each argument expression is evaluated
once, and the values returned are passed as parameters to the function.
If an argument expression is a function call it will be necessary to
perform recursive evaluation of its argument expressions.  The recursion
ends when you get to literal expressions or special forms (they then
dictate which of their subforms get evaluated).

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Pierpaolo BERNARDI
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <4xdh8.38426$_u5.1131919@news1.tin.it>
"Ranco Marcus" <·······@wish.nl> ha scritto nel messaggio
····························@zwoll1.home.nl...

> I was wondering, when a Lisp interpreter is evaluating its expressions,
what
> criteria is used to tell the interpreter that eval should stop. After all,
> after a certain amount of evaluations the resulting expression is in
normal
> form.

There are certain classes of objects that are known to the system
to be in normal form.  An evaluator stops when it sees one of these.

> Does the interpreter use a predicate for this (like normalp) or does it
have
> something to do with the fixed point?
> Does a Lisp programmer have access to this, say, predicate?

Yes. It's called CONSTANTP in Common Lisp.


Cheers
P.
From: Alexey Dejneka
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <m3adtm8fuw.fsf@comail.ru>
"Pierpaolo BERNARDI" <··················@hotmail.com> writes:

> "Ranco Marcus" <·······@wish.nl> ha scritto nel messaggio
> ····························@zwoll1.home.nl...
> 
> > I was wondering, when a Lisp interpreter is evaluating its expressions,
> what
> > criteria is used to tell the interpreter that eval should stop. After all,
> > after a certain amount of evaluations the resulting expression is in
> normal
> > form.
> 
> There are certain classes of objects that are known to the system
> to be in normal form.  An evaluator stops when it sees one of these.

If it were true, (EVAL (EVAL X)) == (EVAL X) (are evaluated to the
same value), but (EVAL (EVAL '(LIST '+ 1 2))) /= (EVAL '(LIST '+ 1 2)).

> > Does the interpreter use a predicate for this (like normalp) or does it
> have
> > something to do with the fixed point?
> > Does a Lisp programmer have access to this, say, predicate?
> 
> Yes. It's called CONSTANTP in Common Lisp.

No.
1. (CONSTANTP 'PI) => T, but (EVAL 'PI) /= 'PI.
2. (EVAL '(LIST '+ 1 X)) => (+ 1 X), but (CONSTANTP '(+ 1 X)) => NIL.

-- 
Regards,
Alexey Dejneka
From: Scott McKay
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <8_oh8.54847$%b6.13890633@typhoon.ne.ipsvc.net>
"Alexey Dejneka" <········@comail.ru> wrote in message
···················@comail.ru...
> "Pierpaolo BERNARDI" <··················@hotmail.com> writes:
>
> >
> > Yes. It's called CONSTANTP in Common Lisp.
>
> No.
> 1. (CONSTANTP 'PI) => T, but (EVAL 'PI) /= 'PI.
> 2. (EVAL '(LIST '+ 1 X)) => (+ 1 X), but (CONSTANTP '(+ 1 X)) => NIL.

This might all be true, but you're forgetting that 'eval' does
different things on atoms and on conses.  On an atom, eval
just returns the atom.  On a cons, eval applies the car of
the cons to the cdr of the cons.

So while 'constantp' returns t for a fixed point, that's not all
there is to the story.
From: Barry Margolin
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <ALqh8.2$0Y4.87@paloalto-snr1.gtei.net>
In article <························@typhoon.ne.ipsvc.net>,
Scott McKay <···@attbi.com> wrote:
>This might all be true, but you're forgetting that 'eval' does
>different things on atoms and on conses.  On an atom, eval
>just returns the atom.

(atom 'pi) => T
(eval 'pi) not => PI

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Frode Vatvedt Fjeld
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <2hg03dbtte.fsf@vserver.cs.uit.no>
"Scott McKay" <···@attbi.com> writes:

> This might all be true, but you're forgetting that 'eval' does
> different things on atoms and on conses.  On an atom, eval just
> returns the atom.  On a cons, eval applies the car of the cons to
> the cdr of the cons.

This is all spelled out in section 3.1.2.1 "Form Evaluation" of the
Hyperspec.

-- 
Frode Vatvedt Fjeld
From: Pierpaolo BERNARDI
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <EMrh8.42653$Ns4.1783896@news2.tin.it>
"Scott McKay" <···@attbi.com> ha scritto nel messaggio
·····························@typhoon.ne.ipsvc.net...

> So while 'constantp' returns t for a fixed point, that's not all
> there is to the story.

You are correct, of course.  I realized this a minute after
I posted, but seems that cancel messages are rarely
obeyed these days.

Cheers,
P.
From: Alexey Dejneka
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <m3ofi1n33u.fsf@comail.ru>
"Scott McKay" <···@attbi.com> writes:
> On an atom, eval
> just returns the atom. 

Even on a symbol?

-- 
Regards,
Alexey Dejneka
From: Eli Barzilay
Subject: Re: fixed point in evaluation
Date: 
Message-ID: <skzo1lwpl0.fsf@mojave.cs.cornell.edu>
"Ranco Marcus" <·······@wish.nl> writes:

> I was wondering, when a Lisp interpreter is evaluating its
> expressions, what criteria is used to tell the interpreter that eval
> should stop. After all, after a certain amount of evaluations the
> resulting expression is in normal form.

Lisp is doing _evaluation_ -- it is inherently different than
_normalization_ which seem to be what you're talking about.  Two
things I know that consider this is 2-Lisp (the basis for 3-Lisp)
which normalizes, and DrScheme, which has printer functions for
students that will print the result of evaluating 'pi as 'pi.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!