From: ··········@bbs.ee.ncu.edu.tw
Subject: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131060531.297651.16640@g44g2000cwa.googlegroups.com>
For investigation of the behavior of parameter list furing defining a
function , I wrote the following codes .
The codes runs well in CLISP-2.34
===============================================================
Break 1 [2]> (defun test (cdr '(x y z))
    (list X Y Z))
TEST
Break 1 [2]> (test 1 2 3)

*** - EVAL/APPLY: too many arguments given to TEST
The following restarts are available:
ABORT          :R1      ABORT
ABORT          :R2      ABORT
Break 2 [3]> (test 1 2)

*** - EVAL: variable X has no value
The following restarts are available:
USE-VALUE      :R1      You may input a value to be used instead of X.
STORE-VALUE    :R2      You may input a new value for X.
ABORT          :R3      ABORT
ABORT          :R4      ABORT
ABORT          :R5      ABORT
Break 3 [4]>

=======================================================
The general form for defining a function is
(defun function-name parameter-list function-body)

My question is that , what decides the evaluation of the parameter-list
? The parameter-list seems evaluated before the building of the
function test . But Look at the following codes (also prepared for you
by me) , which also runs well in the same CLISP-2.34
=========================================================
Break 3 [4]> (defun test (list X Y Z)
      (list X Y Z))
TEST
Break 3 [4]> (test 1 2 3 )

*** - EVAL/APPLY: too few arguments given to TEST
The following restarts are available:
ABORT          :R1      ABORT
ABORT          :R2      ABORT
ABORT          :R3      ABORT
ABORT          :R4      ABORT
Break 4 [5]> (test 1 2 3 4)
(2 3 4)
Break 4 [5]>
===========================================================

It seems that the parameter list is not evaluated to (X Y Z)
thus the "list" was considered a parameter.

Because I am new to common lisp , I tried hard for understanding the
behavior of the interpreter . But I got some very suprising result as
above . Is common lisp a reliable language ? If everything can just
suprise me , I won't think common lisp is a good language .

From: ··········@bbs.ee.ncu.edu.tw
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131061358.268295.110610@g49g2000cwa.googlegroups.com>
Another codes:
=================
Break 6 [7]>  (defun test (cdr '(x y z))
    (list  cdr '(x y z))
)
TEST
Break 6 [7]> (test 1 2)
(1 (X Y Z))
Break 6 [7]>
From: Pisin Bootvong
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131072297.867034.160680@g14g2000cwa.googlegroups.com>
··········@bbs.ee.ncu.edu.tw wrote:
> For investigation of the behavior of parameter list furing defining a
> function , I wrote the following codes .
> The codes runs well in CLISP-2.34
> ===============================================================
> Break 1 [2]> (defun test (cdr '(x y z))
>     (list X Y Z))
> TEST
> Break 1 [2]> (test 1 2 3)
>
> *** - EVAL/APPLY: too many arguments given to TEST
> The following restarts are available:
> ABORT          :R1      ABORT
> ABORT          :R2      ABORT
> Break 2 [3]> (test 1 2)
>
> *** - EVAL: variable X has no value
> The following restarts are available:
> USE-VALUE      :R1      You may input a value to be used instead of X.
> STORE-VALUE    :R2      You may input a new value for X.
> ABORT          :R3      ABORT
> ABORT          :R4      ABORT
> ABORT          :R5      ABORT
> Break 3 [4]>
>
> =======================================================
> The general form for defining a function is
> (defun function-name parameter-list function-body)
>
> My question is that , what decides the evaluation of the parameter-list
> ? The parameter-list seems evaluated before the building of the
> function test . But Look at the following codes (also prepared for you
> by me) , which also runs well in the same CLISP-2.34
> =========================================================
> Break 3 [4]> (defun test (list X Y Z)
>       (list X Y Z))
> TEST
> Break 3 [4]> (test 1 2 3 )
>
> *** - EVAL/APPLY: too few arguments given to TEST
> The following restarts are available:
> ABORT          :R1      ABORT
> ABORT          :R2      ABORT
> ABORT          :R3      ABORT
> ABORT          :R4      ABORT
> Break 4 [5]> (test 1 2 3 4)
> (2 3 4)
> Break 4 [5]>
> ===========================================================
>
> It seems that the parameter list is not evaluated to (X Y Z)
> thus the "list" was considered a parameter.
>
> Because I am new to common lisp , I tried hard for understanding the
> behavior of the interpreter . But I got some very suprising result as
> above . Is common lisp a reliable language ? If everything can just
> suprise me , I won't think common lisp is a good language .

paramter list of defun is always unevaluate, just like in any other
language

 (defun foo (list x y z)
   ...)

is like in Java of:

 Value foo(Value list, Value x, Value y, Value z){
    ...
 }

or ruby of

 def foo(list, a, b, c)
    ...
 end

In other word, you have just defined a function first parameter of is
named 'list'.

Do this instead

 (defun test (X Y Z)
    (list X Y Z))

For you first example, I don't know your expected behavior.
From: Barry Margolin
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <barmar-188ED8.19213003112005@comcast.dca.giganews.com>
In article <·······················@g44g2000cwa.googlegroups.com>,
 ··········@bbs.ee.ncu.edu.tw wrote:

> My question is that , what decides the evaluation of the parameter-list
> ? The parameter-list seems evaluated before the building of the
> function test . But Look at the following codes (also prepared for you
> by me) , which also runs well in the same CLISP-2.34

The parameter list is not evaluated at all when you're defining the 
function.  It's just a list of variables that will be given values when 
the function is valled.

> =========================================================
> Break 3 [4]> (defun test (list X Y Z)
>       (list X Y Z))
> TEST
> Break 3 [4]> (test 1 2 3 )
> 
> *** - EVAL/APPLY: too few arguments given to TEST
> The following restarts are available:
> ABORT          :R1      ABORT
> ABORT          :R2      ABORT
> ABORT          :R3      ABORT
> ABORT          :R4      ABORT
> Break 4 [5]> (test 1 2 3 4)
> (2 3 4)
> Break 4 [5]>
> ===========================================================
> 
> It seems that the parameter list is not evaluated to (X Y Z)
> thus the "list" was considered a parameter.

Your function takes four parameters.  The first parameter is named LIST, 
the second parameter is named X, the third is named Y, and the fourth is 
named Z.

-- 
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
From: Joe Marshall
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <ek5xvwrq.fsf@alum.mit.edu>
··········@bbs.ee.ncu.edu.tw writes:

> The general form for defining a function is
> (defun function-name parameter-list function-body)
>
> My question is that , what decides the evaluation of the parameter-list
> ? The parameter-list seems evaluated before the building of the
> function test . 

The parameter list is never evaluated.  It is simply a list of the
names of parameters.

> But Look at the following codes (also prepared for you
> by me) , which also runs well in the same CLISP-2.34
> =========================================================
> Break 3 [4]> (defun test (list X Y Z)
>       (list X Y Z))
> TEST

As Barry pointed out, you have defined TEST to be a function of 4
arguments, the first one is named LIST, the next three are X, Y, and
Z.  You could call it like this:

(test 5 63 42 11)

and get the answer 
 (63 42 11)

> It seems that the parameter list is not evaluated to (X Y Z)
> thus the "list" was considered a parameter.

Yep.  You got it.

> Because I am new to common lisp , I tried hard for understanding the
> behavior of the interpreter . But I got some very suprising result as
> above . Is common lisp a reliable language ? If everything can just
> suprise me , I won't think common lisp is a good language .

Few languages have as simple and consistent an interpretation model as
Common Lisp (try writing a C interpreter some time).

You seem to have some strange ideas about how languages work.
From: Peter Seibel
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <m2zmol6u9n.fsf@gigamonkeys.com>
··········@bbs.ee.ncu.edu.tw writes:

> Because I am new to common lisp , I tried hard for understanding the
> behavior of the interpreter . But I got some very suprising result
> as above . Is common lisp a reliable language ? If everything can
> just suprise me , I won't think common lisp is a good language .

You may want to consider, given that your intuition about how things
ought to work and how they actually do work are so at odds, that it
might be more effective for you to stop trying to guess how Common
Lisp works by poking around at the REPL and just read something that
explains the basics. Lisp is a actually a remarkably consistent
language built around a few powerful concepts but it's going to be
hard to deduce what they are by just poking at it.

-Peter

-- 
Peter Seibel           * ·····@gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/
From: ··········@bbs.ee.ncu.edu.tw
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131113889.816087.10440@g44g2000cwa.googlegroups.com>
Peter , I have read a few books that explains Lisp .
Eg , Practical Common Lisp , On Lisp , Successful lisp ,
Interpreting LISP . I also checked CLtL2 during coding.

Among these books , of course some are too advanced for me to
understand well , eg , I can only follow the chapters before
Destructuring in the book of On Lisp. Some books are very academic , eg
 Interpreting LISP , it says that the number can be represented by the
length of list. And your book helps me a lot and now I am reading the
chapter of generic function . Let me say thanks to you.

Why do I always try the behavior of Lisp if I can read from books ?
Because I sometimes I am not sure what the books really mean . I other
words , I am so stupid that without tryng , I can't understand what I
read.


> You may want to consider, given that your intuition about how things
> ought to work and how they actually do work are so at odds, that it
> might be more effective for you to stop trying to guess how Common
> Lisp works by poking around at the REPL and just read something that
> explains the basics. Lisp is a actually a remarkably consistent
> language built around a few powerful concepts but it's going to be
> hard to deduce what they are by just poking at it.
> 
> -Peter
From: Tayssir John Gabbour
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131121054.304918.244250@g14g2000cwa.googlegroups.com>
··········@bbs.ee.ncu.edu.tw wrote:
> Peter , I have read a few books that explains Lisp .
> Eg , Practical Common Lisp , On Lisp , Successful lisp ,
> Interpreting LISP . I also checked CLtL2 during coding.
>
> Among these books , of course some are too advanced for me to
> understand well , eg , I can only follow the chapters before
> Destructuring in the book of On Lisp. Some books are very academic , eg
>  Interpreting LISP , it says that the number can be represented by the
> length of list. And your book helps me a lot and now I am reading the
> chapter of generic function . Let me say thanks to you.
>
> Why do I always try the behavior of Lisp if I can read from books ?
> Because I sometimes I am not sure what the books really mean . I other
> words , I am so stupid that without tryng , I can't understand what I
> read.

That's not dumb. Books are a very low-bandwidth way to communicate
info. People really learn by teaching each other, and getting their
hands dirty. I think David Noble explained it well when pointing out
that technologies are actively anti-education when they attempt to
reduce the teacher-student ratio.

Unfortunately, books are fetishized. People conspicuously consume them
in order to pose as more intelligent, which is why many people feel
quite dumb, as you seem to. ;)


Tayssir
From: Cameron MacKinnon
Subject: OT: Books and education
Date: 
Message-ID: <Qu2dne6XOYyhCPbeRVn-tg@rogers.com>
Tayssir John Gabbour wrote:
> ··········@bbs.ee.ncu.edu.tw wrote:
> 
>>Why do I always try the behavior of Lisp if I can read from books ?
>>Because I sometimes I am not sure what the books really mean . I other
>>words , I am so stupid that without tryng , I can't understand what I
>>read.
> 
> That's not dumb. Books are a very low-bandwidth way to communicate
> info. People really learn by teaching each other, and getting their
> hands dirty. I think David Noble explained it well when pointing out
> that technologies are actively anti-education when they attempt to
> reduce the teacher-student ratio.

I find books quite high-bandwidth. I can read faster than most people 
can comfortably talk (who can't?), the table of contents and index make 
whole-topic visualization and navigation within the corpus easy, and the 
pretty illustrations aid in quick visualizations. My books are available 
for consultation at 3AM and even after their authors are dead. Of 
course, some books are better than others -- just as with teachers.

Now the BEST teacher, who has rehearsed his notes, prepared 
illustrations beforehand, knows the topic backwards and forwards and is 
sensitive to the ACKs and NAKs of his one or two students may well be 
better than a book. How many of us have the time, money and 
spatial/temporal proximity to take advantage of such resources?

At the university level (where David Noble seems to concentrate his 
interest) particularly, "teachers" aren't typically hired based on their 
teaching ability, but rather their research and publishing skills. Has 
any correlation been shown between the two?

Here's a new economic theory I just cooked up: People who focus on 
student-teacher ratios and who advocate for reductions thereof are 
actively anti-education. The best teachers and those most in love with 
teaching are already in the profession,* so attempts to increase the 
number of teachers must (by economic tautology) be acting at the margin, 
bringing in teachers who are in it for the money, who wouldn't have been 
hired if the demand had been lower and who are only marginally more 
interested in teaching than in other activities.

* - Unproven. One could argue that teachers' salaries are too low and 
that many who would love to teach can't afford to.
From: vishnuvyas
Subject: Re: OT: Books and education
Date: 
Message-ID: <1131125521.079467.121390@z14g2000cwz.googlegroups.com>
Cameron MacKinnon wrote:
> Here's a new economic theory I just cooked up: People who focus on
> student-teacher ratios and who advocate for reductions thereof are
> actively anti-education. The best teachers and those most in love with
> teaching are already in the profession,* so attempts to increase the
> number of teachers must (by economic tautology) be acting at the margin,
> bringing in teachers who are in it for the money, who wouldn't have been
> hired if the demand had been lower and who are only marginally more
> interested in teaching than in other activities.
>
> * - Unproven. One could argue that teachers' salaries are too low and
> that many who would love to teach can't afford to.

Come deep down to south-india and you would just find your economic
theory in full flinging action.
Here we have 223 Engineering Colleges (thats a HUGE number!), each with
a cs-dept. and guess what? There's more demand than there is supply.
And thats where your theory works.. (If you are doing an economics
PhD.. this might be a good place for field work ;-)

Cheers
Vishnu Vyas.
From: Tayssir John Gabbour
Subject: Re: OT: Books and education
Date: 
Message-ID: <1131130956.184368.326290@f14g2000cwb.googlegroups.com>
Cameron MacKinnon wrote:
> Tayssir John Gabbour wrote:
> > ··········@bbs.ee.ncu.edu.tw wrote:
> >
> >>Why do I always try the behavior of Lisp if I can read from books ?
> >>Because I sometimes I am not sure what the books really mean . I other
> >>words , I am so stupid that without tryng , I can't understand what I
> >>read.
> >
> > That's not dumb. Books are a very low-bandwidth way to communicate
> > info. People really learn by teaching each other, and getting their
> > hands dirty. I think David Noble explained it well when pointing out
> > that technologies are actively anti-education when they attempt to
> > reduce the teacher-student ratio.
>
> I find books quite high-bandwidth. I can read faster than most people
> can comfortably talk (who can't?), the table of contents and index make
> whole-topic visualization and navigation within the corpus easy, and the
> pretty illustrations aid in quick visualizations. My books are available
> for consultation at 3AM and even after their authors are dead. Of
> course, some books are better than others -- just as with teachers.
>
> Now the BEST teacher, who has rehearsed his notes, prepared
> illustrations beforehand, knows the topic backwards and forwards and is
> sensitive to the ACKs and NAKs of his one or two students may well be
> better than a book. How many of us have the time, money and
> spatial/temporal proximity to take advantage of such resources?
>
> At the university level (where David Noble seems to concentrate his
> interest) particularly, "teachers" aren't typically hired based on their
> teaching ability, but rather their research and publishing skills. Has
> any correlation been shown between the two?
>
> Here's a new economic theory I just cooked up: People who focus on
> student-teacher ratios and who advocate for reductions thereof are
> actively anti-education. The best teachers and those most in love with
> teaching are already in the profession,* so attempts to increase the
> number of teachers must (by economic tautology) be acting at the margin,
> bringing in teachers who are in it for the money, who wouldn't have been
> hired if the demand had been lower and who are only marginally more
> interested in teaching than in other activities.
>
> * - Unproven. One could argue that teachers' salaries are too low and
> that many who would love to teach can't afford to.

You and Ulrich are like clockwork. ;)

I dash off a small, minor commiserating post on why the OP shouldn't
feel like a bonehead, because I think many people are learning Lisp in
isolated circumstances, and you're like "No, he's a fucking retard, I
really know how to suck the marrow out of a book!"

;)


Tayssir
From: Ulrich Hobelmann
Subject: Re: OT: Books and education
Date: 
Message-ID: <3t1oq6Fqi65iU1@individual.net>
Cameron MacKinnon wrote:
> Here's a new economic theory I just cooked up: People who focus on 
> student-teacher ratios and who advocate for reductions thereof are 
> actively anti-education. The best teachers and those most in love with 
> teaching are already in the profession,* so attempts to increase the 
> number of teachers must (by economic tautology) be acting at the margin, 
> bringing in teachers who are in it for the money, who wouldn't have been 
> hired if the demand had been lower and who are only marginally more 
> interested in teaching than in other activities.

Well, let's say that like all other cases of artificially inflated 
demand, *forcing* an increase in the number of teachers might be 
counterproductive.  But creating an environment that's friendly to 
educators might attract more good teachers than currently out there. 
See below.

> * - Unproven. One could argue that teachers' salaries are too low and 
> that many who would love to teach can't afford to.

Then I'd say that something is actively working to keep salaries down? 
Where you allow people to spend money on education, there are good 
teachers (such as many US universities).  But I think it's mostly not 
about money.

I went to a private high school, but because the government actively 
fights those schools and doesn't pay them the same per-student subsidies 
it pays to state-managed schools, they have to charge money (of course 
they then criticize those schools for charging money and not being 
affordable by everyone, but of course government officials send their 
kids to those very same private schools).  Anyway, teachers there earned 
*less* than teachers at public schools, but we had some really good 
teachers, maybe because they had more freedom at our school.  Public 
schools absolutely suck (well, most of them).  Even my school sucked, 
but I'd file that under (influence of (group pressure) or (our system in 
general)).

There are probably many good teachers out there that cho(o)se not to 
teach.  Usually I would expect every country to yield a certain 
percentage of *great* (university) teachers.  Maybe the German ones 
moved abroad (Brain Drain is a BIG issue over here), or our education 
system stifled them, so they persued other careers.  One of my own 
reasons for not becoming a (high school) teacher is our education system 
(that, and my not likely being a good teacher).  Teachers' pay is quite 
good in Germany, unlike in the US.

-- 
The road to hell is paved with good intentions.
From: Ulrich Hobelmann
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <3t1nn6FqiujhU1@individual.net>
Tayssir John Gabbour wrote:
> Unfortunately, books are fetishized. People conspicuously consume them
> in order to pose as more intelligent, which is why many people feel
> quite dumb, as you seem to. ;)

The only people I know who bother to read books at all are doing it out 
of interest.  Posers usually don't bother to read, and only read quick 
info that's available online.

If everybody in the USA or Europe would read (non-fiction maybe) books 
for half an hour a day, we wouldn't have nearly as many dumb people.

-- 
The road to hell is paved with good intentions.
From: vishnuvyas
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131126085.560191.63780@g44g2000cwa.googlegroups.com>
> My question is that , what decides the evaluation of the parameter-list
> ? The parameter-list seems evaluated before the building of the
> function test . But Look at the following codes (also prepared for you
> by me) , which also runs well in the same CLISP-2.34

I guess you mis-understood the part about function-application vs
function-definition.

ok.. here are some pointers that can help you..

1. The arguments to a function are *always evaluated* before the
function is called.
i.e
 (myfunc arg1 arg2 arg3)
would mean arg1 , arg2, and arg3 are all evaluated before myfunc is
called (i.e, myfunc gets the values of after evaluating arg1, arg2..
etc..)

(defun add2nos (x y) (+ x y) )

(add2nos (+ 3 5) (+ 2 1) )  becomes => (add2nos 8 3) => 11
[see the evaluation only occours when you are calling the function not
when you are defining it?]

2. OTOH, when you are defining a function, you are just giving place
holders (formal parameters) for evantual values that you will be using
inside your functions, so there is no point evaluating them.

> Because I am new to common lisp ,
yes, I can see that..

> behavior of the interpreter . But I got some very suprising result as
> above . Is common lisp a reliable language ? If everything can just
Hmm.. as far as I've seen, CL is as standardised as it gets (java is
slightly better there).

Cheers
Vishnu
From: Kaz Kylheku
Subject: Re: What deciseds the evaluation of parameter List ?
Date: 
Message-ID: <1131129983.026476.105870@g14g2000cwa.googlegroups.com>
··········@bbs.ee.ncu.edu.tw wrote:
> For investigation of the behavior of parameter list furing defining a
> function , I wrote the following codes .

After this posting, there can be no more doubt that you are a troll.

There are people in this world who really /are/ this incredibly stupid,
yes. But they don't play with command-line CLISP and ask questions
about it.

That is to say, the /genuine/ complete moron doesn't install a Lisp
implementation, type syntactically correct expressions into it and then
go on Usenet to ask the most moronic questions about its semantics.

The behavior lands squarely in a /contrived/ behavior space.