From: bamb (Stefan Bamberger)

Subject: Re: Problem (?) with evalhook

Date: 1997-4-28 12:18

>Hi, I am trying to get the following piece of code to run in Allegro CL 3.0. >It was taken from the common lisp manual. > >http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/misc/mosaic/common/omega/Web/Groups >/AI/html/cltl/clm/node180.html >
[schnipp]
> >According to the manual it should behave like this: > >(hook '(cons (floor *print-base* 2) 'b)) > Form: (CONS (FLOOR *PRINT-BASE* 2) (QUOTE B)) > Form: (FLOOR *PRINT-BASE* 3) > Form: *PRINT-BASE* > Value: 10 > Form: 3 > Value: 3 > Value: 3 1 > Form: (QUOTE B) > Value: B > Value: (3 . B) >(3 . B) > >Instead Allegro 3.0 returns: > >(5 . B) (with out printing any messages) > > >Does anybody know why this won't work? > >thanks, > >Lael
I think you're confronted with several problems ;-) : 1.) It looks like you have a code-modifying compiler: You entered ... (floor *print-base* 2) .... but evaluated is (FLOOR *PRINT-BASE* 3) ^^^^!!!! That explains the different results. It's a printing error in CLtL2. 2.) As far as I know, the evalhook will be only used, when your Lisp is in interpreter mode, that means, if your code is not compiled. I suppose that all modern Lisp environments which have both an interpreter and a compiler are set to compiler mode per default. I don't know the ACL environment for UNIX but look for a global variable similar to *compile-definitions*. 3.) Although evalhook and applyhook are mentioned in CLtL 2nd edition, I read that X3J13 voted to remove these guys from the standard ..... I don't know if it's worth experimenting with them if the next release will skip them. - stefan ______________________________________________________________________________ Stefan K. Bamberger email: <informatik.uni-wuerzburg.de at bambi> Lehrstuhl fuer K"unstliche Intelligenz fax : ++49 931 7056120 Allesgrundweg 12, 97218 Gerbrunn voice : ++49 931 7056118 Universit"at W"urzburg, Germany ______________________________________________________________________________