From: Munk
Subject: Hopefully quick question
Date: 
Message-ID: <xr6j3.370$Wa1.25484@axe.netdoor.com>
I am very new to Lisp and I am having some trouble getting used to its
syntax, etc...   I need to write a predicate function that will accept two
lists of any type, and tell whether they are compatible by structure, value,
or not at all.  It won't have input or output but will instead return the
CS, CV, or NC.  Can somebody give me an idea on where to start on this?  Any
help would be greatly appreciated.

Thanks in advance for any help.

From: Nick Levine
Subject: Re: Hopefully quick question
Date: 
Message-ID: <7mj1g1$716$1@barcode.tesco.net>
This wouldn't be a homework assignment now, would it?

Munk wrote in message ...
>I am very new to Lisp and I am having some trouble getting used to its
>syntax, etc...   I need to write a predicate function that will accept two
>lists of any type, and tell whether they are compatible by structure,
value,
>or not at all.  It won't have input or output but will instead return the
>CS, CV, or NC.  Can somebody give me an idea on where to start on this?
Any
>help would be greatly appreciated.
>
>Thanks in advance for any help.
>
>

By the way, my understanding of a "predicate" is that it can only return two
possible values: true or false. The function you desire seems to have three
up its sleeve.

- nick (barely in posession of any opinions at all today)
From: Nick Levine
Subject: Re: Hopefully quick question
Date: 
Message-ID: <7mk8mp$3og$1@epos.tesco.net>
Nick Levine wrote in message <············@barcode.tesco.net>...
>This wouldn't be a homework assignment now, would it?

From: Brian Norwood <····@ra.msstate.edu>
To: Nick Levine <···········@tesco.net>
Date: 15 July 1999 04:11
Subject: Re: Hopefully quick question

>Yes it is...actually it is a programming assignment I have for a class.  It
>is a survey of Programming Languages, and we have to pick up the different
>languages as we go (ie no book), and I really don't want to spend money on
a
>LISP book that I won't use much.


OK, fair enough.


>> >I am very new to Lisp and I am having some trouble getting used to its
>> >syntax, etc...   I need to write a predicate function that will accept
>two
>> >lists of any type, and tell whether they are compatible by structure,
>> value,
>> >or not at all.  It won't have input or output but will instead return
the
>> >CS, CV, or NC.  Can somebody give me an idea on where to start on this?
>> Any
>> >help would be greatly appreciated.


Lisp provides a number of equality predicates. EQ is true of two "truely
identical" objects, whereas EQUAL is true (approximately) of objects which
print the same. So you might end up with a function definition like:

(defun test (x y)
   (cond ((eq x y) 'eq)
         ((equal x y) 'equal)
         (t nil)))

Then we might have a sesion such as:

(setq foo '(1 2 3)
      bar '(1 2 3)
      qux '(3 2 1))

(test foo foo) => eq
(test foo bar) => equal
(test foo qux) => nil

See the Common Lisp Hyperspec
    http://www.harlequin.com/education/books/HyperSpec/FrontMatter/
for definitions of EQ, EQUAL and other equality predicates provided in the
language.

Post back to this group if you are still stuck.

Regards,

- nick
From: Fernando Mato Mira
Subject: Re: Hopefully quick question
Date: 
Message-ID: <378DB2AC.8FCCBEED@iname.com>
Nick Levine wrote:

> Nick Levine wrote in message <············@barcode.tesco.net>...
> >This wouldn't be a homework assignment now, would it?
>
> From: Brian Norwood <····@ra.msstate.edu>
> To: Nick Levine <···········@tesco.net>
> Date: 15 July 1999 04:11
> Subject: Re: Hopefully quick question
>
> >Yes it is...actually it is a programming assignment I have for a class.  It
> >is a survey of Programming Languages, and we have to pick up the different
> >languages as we go (ie no book), and I really don't want to spend money on
> a
> >LISP book that I won't use much.
>
> OK, fair enough.

[explanation deleted]

The right thing for Brian to do now, if he has not before is:

1. Check what Lisp books they have at the library [and we could tell him which
ones to avoid]
2. If they have none, make a request that they buy at least one [which?]

Maybe for the comp.lang.lisp FAQ:

"I have a homework question but I can't justify buying a Lisp book.What can I
do?"

Regards,

--
Fernando D. Mato Mira
From: William Deakin
Subject: Re: Hopefully quick question
Date: 
Message-ID: <378EFA72.AB8DCBC8@pindar.com>
Fernando Mato Mira wrote:

> .. If they have none, make a request that they buy at least one [which?]

Just to kick this flame war off: what about ANSI Common Lisp, or Paradigms of AI?
But not Steele.

> Maybe for the comp.lang.lisp FAQ:
>
> "I have a homework question but I can't justify buying a Lisp book.What can I
> do?"

What an excellent idea.

Regards,

:-) will
From: Gareth McCaughan
Subject: Re: Hopefully quick question
Date: 
Message-ID: <86aeswfw9z.fsf@g.pet.cam.ac.uk>
William Deakin wrote:

>> .. If they have none, make a request that they buy at least one [which?]
> 
> Just to kick this flame war off: what about ANSI Common Lisp, or
> Paradigms of AI?  But not Steele.

"Paradigms" is a great book, but I don't think I'd recommend it
for newcomers to Lisp; presumably that's the main thing the
library would need it for.

I'm not in a good position to comment on books for beginners,
because I learned CL mostly from Steele and the HyperSpec;
this probably isn't a good approach for people who, unlike
me, haven't known other dialects of Lisp for years. :-)

-- 
Gareth McCaughan            Dept. of Pure Mathematics & Math. Statistics,
················@pobox.com  Cambridge University, England.
From: William Deakin
Subject: Re: Hopefully quick question
Date: 
Message-ID: <3792F5B5.AF317665@pindar.com>
Gareth McCaughan wrote:

> "Paradigms" is a great book, but I don't think I'd recommend it for newcomers
> to Lisp; presumably that's the main thing the library would need it for.

I don't know. If you want a library book that says 'so if you read this book
and you have access to a lisp compiler and would like to learn CL' then
something like ANSI Common Lisp is good (and I'm sure there are others). But if
you don't want to learn CL or don't know what CL is ("is it a fish? Like a
zebra fish or like a haddock") then "Paradigms" covers so much stuff in a very
readable way.

Now to sell ANSI CL a bit short (it has alot of really good examples). At 432
B4 pages vs 947 pages of some-strange-American-page-size-larger-than B4, full
of all sorts of stuff, "Paradigms" is an excellent beastiary. ("and now we have
the lesser spotted Common Lisp, popular with men with propellers attached to
their heads").

> I'm not in a good position to comment on books for beginners, because I
> learned CL mostly from Steele and the HyperSpec...

That must have been a painful way to learn. Then again I can't claim to have
anything other than passing aquaintance with CL. I wouldn't want Erik to accuse
ME of lying ;-)

Best Regards,

:-) will
From: Lieven Marchand
Subject: Re: Hopefully quick question
Date: 
Message-ID: <m3ogh8jzod.fsf@localhost.localdomain>
William Deakin <·····@pindar.com> writes:

> Gareth McCaughan wrote:
> > I'm not in a good position to comment on books for beginners, because I
> > learned CL mostly from Steele and the HyperSpec...
> 

<AOL> Me too </>

> That must have been a painful way to learn. Then again I can't claim to have
> anything other than passing aquaintance with CL. I wouldn't want Erik to accuse
> ME of lying ;-)
> 

Not really. But then again, my first Lisp book still talked about
FSUBR's and FEXPR's. What do you have against CLtL? It's quite readable.

-- 
Lieven Marchand <···@bewoner.dma.be>
If there are aliens, they play Go. -- Lasker
From: William Deakin
Subject: Re: Hopefully quick question
Date: 
Message-ID: <37942C8F.E48EB147@pindar.com>
Lieven Marchand wrote:

> What do you have against CLtL? It's quite readable.

I don't think I have anything against CLtL, but can you buy CLtL? After a minimal
search (5 minutes in a local bookshop trying to order it, Amazon.com &c) I could only
get hold of CLtL2! I also don't have a big thing against CLtL2: its great if you want
a comprehensive technical reference; and some of the references to the Mutant Ninja
Turtles are amusing; but I'm not sure its the best thing for somebody who doesn't
know anything about CL.

I was trying to say something about books that a library might buy, for the
disinterested or uninformed. I personally have found CLtL2 a little unreadable. But
this is a bit like trying to explain why you like a particular meal and to try and
convince somebody else that they ought to try it and if they like it, to try and cook
it themselves. I like vegetable lasagne for example (although I'm not sure how to
spell it) and have a crack at cooking one from time to time.

However, I think CLtL2 is like trying to convince somebody else to try lasagne by
describing the ingredients and the way the ingredients were grown and then combined.
More like a recipe or dig-for-victory handbook, great if you want to be a chef or a
carrot farmer. But not a way to get somebody excited about the eating the meal or
wanting to cook one for themselves. For this you need the writings of a food writer,
somebody who can whet the appetite, and then maybe, then convince you to go home and
cook vegetable lasagne for yourself.

I'm sorry about this analogy, is has starting to creak a bit. But I hope it explains
what I was trying to say.

Best Regards,

:-) will
From: Gareth McCaughan
Subject: Re: Hopefully quick question
Date: 
Message-ID: <86btd85m5d.fsf@g.local>
William Deakin wrote:

[I said:]
>> I'm not in a good position to comment on books for beginners, because I
>> learned CL mostly from Steele and the HyperSpec...
> 
> That must have been a painful way to learn. Then again I can't claim
> to have anything other than passing aquaintance with CL. I wouldn't
> want Erik to accuse ME of lying ;-)

Well, I didn't find it particularly painful, but then I already
had some clue about other Lisps. Possibly if I'd been told "You
have to become an expert CL-er in two weeks, and these are the
only resources you get" it might have been a different matter.

-- 
Gareth McCaughan            Dept. of Pure Mathematics & Math. Statistics,
················@pobox.com  Cambridge University, England.
From: William Deakin
Subject: Re: Hopefully quick question
Date: 
Message-ID: <379437E5.FA6BB289@pindar.com>
Gareth McCaughan wrote:

> Well, I didn't find it particularly painful, but then I already had some
> clue about other Lisps.

I'm sorry about that remark. It was only whimsy. I had a relatively pain free
introduction to CL involving enthusiatic people banging my head against a wall
for a week. It was fun :-)

> Possibly if I'd been told "You have to become an expert CL-er in two weeks,
> and these are the only resources you get" it might have been a different
> matter.

This is something of the point I was trying to make. To an outsider CL is
weird. paren-a-phobia is one way I have heard it described. It is very
different from the common-or-garden programming languages but I believe CL is
EXCELLENT.

To put hurdles in the way of people who don't have a clue about Lisps and
don't even want to want to learn CL but who would be better people for doing
so, seems foolish. There are enough hard things to be thinking about: trying
to get your head round recursion; macros if you have never seen one before;
world peace; the cure for the common cold &c; rather than making life more
complicated.

I'm not trying suggest that this is what you mean or to have a go about Steele
or the Hyperspec but I feel passionately that learning should be fun and as
pain-free as possible. And for me, personally, Steele and the Hyperspec
wouldn't be the easiest way to learn.

I was trying to think up another cooking analogy but failed :-(

Best Regards,

:-) Will
From: Gareth McCaughan
Subject: Re: Hopefully quick question
Date: 
Message-ID: <86673fjbmq.fsf@g.local>
William Deakin wrote:

> I'm not trying suggest that this is what you mean or to have a go
> about Steele or the Hyperspec but I feel passionately that learning
> should be fun and as pain-free as possible. And for me, personally,
> Steele and the Hyperspec wouldn't be the easiest way to learn.

I totally agree. I wouldn't suggest that anyone else should learn
CL from Steele & the HyperSpec. Unless they want to, of course. :-)

-- 
Gareth McCaughan  ················@pobox.com
sig under construction
From: Kent M Pitman
Subject: Re: Hopefully quick question
Date: 
Message-ID: <sfwn1wq4xlx.fsf@world.std.com>
Gareth McCaughan <················@pobox.com> writes:

> William Deakin wrote:
> 
> > I'm not trying suggest that this is what you mean or to have a go
> > about Steele or the Hyperspec but I feel passionately that learning
> > should be fun and as pain-free as possible. And for me, personally,
> > Steele and the Hyperspec wouldn't be the easiest way to learn.
> 
> I totally agree. I wouldn't suggest that anyone else should learn
> CL from Steele & the HyperSpec. Unless they want to, of course. :-)

Exactly what I would have said.

Those two documents have a particular purpose, and for neither was
it teaching a beginner.
From: Vassil Nikolov
Subject: Re: Hopefully quick question
Date: 
Message-ID: <l03130302b3baa6df2463@195.138.129.109>
William Deakin wrote:                [1999-07-20 09:48 +0100]

  [...]
  > learning should be fun and as
  > pain-free as possible.

I'm not sure about the pain-free part.  In fact I believe that
effective learning is a painful process.

(I don't know how to properly attribute this last phrase.  I
heard it from my higher algebra professor but I have no idea
if it was his own or he took it from somewhere.)


Vassil Nikolov
Permanent forwarding e-mail: ········@poboxes.com
For more: http://www.poboxes.com/vnikolov
  Abaci lignei --- programmatici ferrei.
From: William Deakin
Subject: Re: Hopefully quick question
Date: 
Message-ID: <37957C43.6D772102@pindar.com>
Vassil Nikolov wrote:

> William Deakin wrote:                [1999-07-20 09:48 +0100]
>
>   > learning should be fun and as pain-free as possible.
>
> I'm not sure about the pain-free part.  In fact I believe that
> effective learning is a painful process.

I agree. But to make it more painful than it need be seems to be the
preserve of the kinked. How about alt.lang.lisp.masochist for those who
require such arcane pursuits?

:-) will