From: ··········@my-deja.com
Subject: LISP starter needs help on CAR and CDR
Date: 
Message-ID: <8t1ais$qie$1@nnrp1.deja.com>
a) Evaluate the following forms in LISP

  i. (CAR(CDR(CAR(CDR ' ((A B)(C D)(E F))))))

 ii. (CAR(CAR ' (CDR(CDR ((A B)(C D)(E F))))))

iii. ' (CAR(CAR(CDR(CDR ((A B)(C D)(E F))))))

b) How to pick up the symbol PEAR by using CARs and CDRs :

  i. (((APPLE)(ORANGE)((PEAR))(((GRAPEFRUIT))))

 ii. ((((APPLE)ORANGE)PEAR)GRAPEFRUIT)


Sent via Deja.com http://www.deja.com/
Before you buy.

From: Martti Halminen
Subject: Re: LISP starter needs help on CAR and CDR
Date: 
Message-ID: <39F43738.71B28110@solibri.com>
··········@my-deja.com wrote:
> 
> a) Evaluate the following forms in LISP
> 
>   i. (CAR(CDR(CAR(CDR ' ((A B)(C D)(E F))))))
> 
>  ii. (CAR(CAR ' (CDR(CDR ((A B)(C D)(E F))))))
> 
> iii. ' (CAR(CAR(CDR(CDR ((A B)(C D)(E F))))))
> 
> b) How to pick up the symbol PEAR by using CARs and CDRs :
> 
>   i. (((APPLE)(ORANGE)((PEAR))(((GRAPEFRUIT))))
> 
>  ii. ((((APPLE)ORANGE)PEAR)GRAPEFRUIT)

If your intention is to learn anything, you'd be better off typing this
to your Lisp interpreter instead of to your news program. The main idea
with an interactive read-eval-print loop is to make it easy for you to
experiment.

- To save some typing just setq anything to the right of the quote to a
convenient variable.

- As an extra credit assignment you should read this:


<URL:
http://www.deja.com/[ST_rn=ps]/qs.xp?ST=PS&svcclass=dnyr&firstsearch=yes&preserve=1&QRY=homework&defaultOp=AND&DBS=1&OP=dnquery.xp&LNG=english&subjects=&groups=comp.lang.lisp&authors=&fromdate=Sept+15+2000&todate=&showsort=score&maxhits=25
>
--
From: Michael J Short
Subject: Re: LISP starter needs help on CAR and CDR
Date: 
Message-ID: <39F58990.7493FDEE@tothemoon.freeserve.co.uk>
··········@my-deja.com wrote:

> a) Evaluate the following forms in LISP
>
>   i. (CAR(CDR(CAR(CDR ' ((A B)(C D)(E F))))))

you could type it in to lisp and see what happens
the answer is D

like this the first thing to look at is the (CDR ' ((A B)(C D)(E F))
section
if you evaluate this what would you have well

CDR = rest
and car = first

the (rest '((A B) (C D) (E F))) = all but the first element in this case
((C D) (E F))
then (first/car ((C D) (E F)) = ((C D)) remember that a subset is no
different than an atom when using these macros,
next (rest (C D)) = D
next (first (D)) = D

hope this helps have a go at the rest and if in dout run it throw lisp
or put a note up on here.

>
>
>  ii. (CAR(CAR ' (CDR(CDR ((A B)(C D)(E F))))))

this one is a trick remember that the list has a ' on the start of it so
no matter what is in side the lisp it is not evaluated, so treat the two
CDR elements as you would any other element.


>
>
> iii. ' (CAR(CAR(CDR(CDR ((A B)(C D)(E F))))))

same here


>
>
> b) How to pick up the symbol PEAR by using CARs and CDRs :
>
>   i. (((APPLE)(ORANGE)((PEAR))(((GRAPEFRUIT))))
>
>  ii. ((((APPLE)ORANGE)PEAR)GRAPEFRUIT)
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
From: Christopher Browne
Subject: Re: LISP starter needs help on CAR and CDR
Date: 
Message-ID: <slrn8v8n8m.3vvoosn.cbbrowne@test.sdt.com>
In our last episode (Mon, 23 Oct 2000 12:22:56 GMT),
the artist formerly known as ··········@my-deja.com said:
>a) Evaluate the following forms in LISP
>
>  i. (CAR(CDR(CAR(CDR ' ((A B)(C D)(E F))))))
>
> ii. (CAR(CAR ' (CDR(CDR ((A B)(C D)(E F))))))
>
>iii. ' (CAR(CAR(CDR(CDR ((A B)(C D)(E F))))))
>
>b) How to pick up the symbol PEAR by using CARs and CDRs :
>
>  i. (((APPLE)(ORANGE)((PEAR))(((GRAPEFRUIT))))
>
> ii. ((((APPLE)ORANGE)PEAR)GRAPEFRUIT)

Is this a homework assignment?  It _looks_ like one...

Usual policy on homework is that if you have some specific question on
how something works, then feel free to ask.

Alternatively, if you want people to do the homework for you, you have
several choices:
 - We can wait until after it is due;
 - Let us know the email address of the instructor so that we may
   submit the answers directly to guarantee that there is no
   misinterpretation (or miscompilation :-)) of the resuts;
 - If you want royalty-free access to the source code of the answers,
   you can pay the going hourly consulting rate of $125/hour, minimum
   of 8hrs, payable in advance.

If none of those options appears acceptable, then you may wish to step
back and ask more particular questions about what it is that you do
not understand about the problems.

[Wow.  There are some pretty cool .sigs amongst the "Signs of a
Klingon Programmer."  Thanks, Bruce!]
-- 
(concatenate 'string "cbbrowne" ·@" "acm.org")
<http://www.hex.net/~cbbrowne/lisp.html>
Signs of a Klingon Programmer #7: "Klingon function calls do not have
'parameters' -- they have 'arguments' -- and they ALWAYS WIN THEM."