From: bechir kenzari
Subject: pythagoras
Date: 
Message-ID: <1993Dec21.191956.18715@ccu1.aukuni.ac.nz>
Merry Christmas and happy new year,

I have been running 'PYTHAGORAS',  a 'Learning' program in
Steven L. Tanimoto's 'THE ELEMENTS OF ARTIFICIAL INTELLIGENCE' (1990),
but kept receiving the following error message:
	> Error: (LAMBDA (X) T) can't be FUNCALLed or APPLYed.
	> While executing: FIND-EXAMPLES-OF
;--------------------------------------------------------------------------
In 'FIND-EXAMPLES', I think this is where the source of the error may reside:
((apply (get c 'predicate) (list (eval x)))
             ;An example has been found...
             (format t "~%~a is an example of concept ~a." x c)
             (setf (get c 'examples-found)
                   (adjoin x (get c 'examples-found)))
             (incf (get c 'number-found))
             )
;-------------------------------------------------------------------------

Has anybody come across the same bug? Would anybody have an idea how
to solve it?

Thank you,

B. Kenzari
······@ccu1.auckland.ac.nz

-- 
From: Barry Margolin
Subject: Re: pythagoras
Date: 
Message-ID: <9312221804.AA25513@telecaster.think.com>
In article <······················@ccu1.aukuni.ac.nz> you write:
>I have been running 'PYTHAGORAS',  a 'Learning' program in
>Steven L. Tanimoto's 'THE ELEMENTS OF ARTIFICIAL INTELLIGENCE' (1990),
>but kept receiving the following error message:
>	> Error: (LAMBDA (X) T) can't be FUNCALLed or APPLYed.
>	> While executing: FIND-EXAMPLES-OF
>;--------------------------------------------------------------------------
>In 'FIND-EXAMPLES', I think this is where the source of the error may reside:
>((apply (get c 'predicate) (list (eval x)))
>             ;An example has been found...
>             (format t "~%~a is an example of concept ~a." x c)
>             (setf (get c 'examples-found)
>                   (adjoin x (get c 'examples-found)))
>             (incf (get c 'number-found))
>             )

First, I assume this a branch of a COND form.  If not, the extra
parenthesis before the APPLY form is suspicious.

What Lisp implementation are you running it in?  It sounds like it has
implemented the X3J13 change described on p.145 of CLtL2, and doesn't
provide back-compatibility as an extension.  Common Lisp originally allowed
lambda expressions as the first argument to APPLY.  This has been changed
so that only functions and function names can be used.

The solution is to change Pythagoras so that it puts functions, rather than
lambda expressions, in the properties in the first place.  Look around for
expressions of the form:

	(lambda ...)

and change them to

	#'(lambda ...)

There's a small possibility that this could change the semantics of the
program.  It could only happen if a lambda expression references a free
variable that is bound in its containing form, and it hasn't been declared
special; the original code would access its top-level value, while the
modified version will create a closure that references the local value.
I haven't seen the code, but I think this is unlikely.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar