From: Günther Thomsen on
On Feb 24, 3:08 pm, ccc31807 <carte...(a)gmail.com> wrote:
> Learning Lisp is like pulling teeth, except more painful!
>
Learning something new should be fun. I at least enjoyed it very so
far, but then, I enjoyed also learning Forth, C and Pascal back when.
Even C++ and Java for a while. Oh, and in Lisp, I stayed so far away
from OOP - I just didn't have a need for it.

If it's painful, chances are you're doing it wrong. Keep in mind that
for virtually all problems there are multiple solutions. Pick an easy
one, go with the flow.
From: Tamas K Papp on
On Wed, 24 Feb 2010 15:08:02 -0800, ccc31807 wrote:

> Learning Lisp is like pulling teeth, except more painful!

Either Lisp is not a good match for you, or you are not ready for it
yet. In either case, you are not likely to benefit from learning Lisp
for now.

Regarding your code: as others have said, it should work fine. You
must be making some mistake when you are running/compiling your
program.

Tamas
From: Kaz Kylheku on
On 2010-02-24, ccc31807 <cartercc(a)gmail.com> wrote:
> Learning Lisp is like pulling teeth, except more painful!
>
> Here is a code snippet copied directly from Figure 11.2, page 178, of
> Graham's 'ANSI Common Lisp':
>
> (defclass rec ()
> (height width))
> (defclass cir ()
> (radius))
> (defmethod area ((x rec))
> (* (slot-value x 'height) (slot-value x 'width )))
> (defmethod area ((x cir))
> (* pi (expt (slot-value x 'radius) 2)))
>
> Here is the error message gives when I try to compile this:

> NO-APPLICABLE-METHOD: When calling #<GENERIC-FUNCTION FIND-METHOD>
> with arguments (#<COMPILED-CLOSURE
> AREA>
> NIL (REC) NIL), no method is applicable.
> [Condition of type METHOD-CALL-TYPE-ERROR]

The error message is impossible from compiling /just/ the above, and nothing
more. It's a message about an erroneous call of the AREA generic function;
but your example has no call at all, only method specializations
defining two flavors of AREA.

It's puzzling because it seems to be complaining that there is no AREA
specialization which takes a REC, which you have in fact defined.

Why don't you post minimal program (all in one file, if possible)
which reproduces the error message, along with steps to reproduce.
Which Lisp implementation are you invoking, in what manner, etc.
From: ccc31807 on
On Feb 25, 2:45 am, Kaz Kylheku <kkylh...(a)gmail.com> wrote:
> The error message is impossible from compiling /just/ the above, and nothing
> more.  It's a message about an erroneous call of the AREA generic function;
> but your example has no call at all, only method specializations
> defining two flavors of AREA.

I sometimes think that the programming gods get together at night for
code reviews, and sometimes where there has been a shedding of blood
in an amount sufficient to atone for programming sins, graciously
extend mercy and forgiveness, even though it's neither earned nor
merited by the programmer.

Yesterday, I had emacs and slime open all day hacking with Lisp during
free moments, and at the end of the day was reviewing Ch 11 of 'ANSI
Common Lisp' when I had the problem. I don't (usually) post to a news
group about an error unless I am at my wit's end, which I was
yesterday evening.

This morning, with a fresh slate, I opened the file, compiled it, and
it ran perfectly. I don't know what I was doing wrong, and certainly
didn't do anything to fix it, so the only explanation I can give is
the remission of programming sins by the programming gods.

CC.
From: ccc31807 on
On Feb 25, 1:23 am, Tamas K Papp <tkp...(a)gmail.com> wrote:
> On Wed, 24 Feb 2010 15:08:02 -0800, ccc31807 wrote:
> > Learning Lisp is like pulling teeth, except more painful!
>
> Either Lisp is not a good match for you, or you are not ready for it
> yet.  In either case, you are not likely to benefit from learning Lisp
> for now.

I strongly disagree. I don't believe that people are 'matched' to
programming languages any more than they are 'matched' to human
languages. A good programmer can program in any language whether he
knows it or not, and a poor programmer can't program in any language
whether he know it or not.

As to 'being ready' this is like lifting weights. The only way you can
be ready to lift heavy weights is to start by lifting light weights
and build yourself up. How could anyone 'be ready' to learn any
language if he never exercised himself by attempting to learn the
language?

> Regarding your code: as others have said, it should work fine.  You
> must be making some mistake when you are running/compiling your
> program.

See my other post this morning. Obviously, I made some mistake, which
was probably related to fooling around all day and corrupting the
environment in some kind of way. I had probably defined a version of
the 'area' function earlier in the day which the environment still
'remembered' and gave the error message. In a perfect world, the error
message would have been something like this: "Hey, you dummy, you
already defined an area function, so you need to give this one a
different name."

Thanks, CC.