Re: FIXNUM type checking error during install

Thomas Russ <[email protected]>
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Nov 13, 2006, at 8:49 AM, Kambiz Darabi wrote:

> Hello,
>
> I was in search of a powerful KR system when I found powerloom on  
> the web.
>
> Its features sound great and fit my requirements.
>
> Now, I tried to install it using CLISP on a Windows machine and get  
> this error while sources/logic/goal-caches.ste is being
> processed:
>
> The value of STELLA::I should be of type FIXNUM.
> The value is: #1=48312004
>    [Condition of type SIMPLE-TYPE-ERROR]
>
> I used emacs lisp some decades ago :-), and don't know much about  
> common lisp (yet).
>
> But I could find out that CLISP' biggest fixnum is:
>
> (print most-positive-fixnum)
> 16777215
>
> So, when I load stella, and then evaluate this:
>
> (string-to-integer "48312004")
>
> I get the same error ('The value of I should be of type COMMON- 
> LISP:FIXNUM.').
>
> Then I redefine string-to-integer to use 'CL:INTEGER' instead of  
> 'CL:FIXNUM' in its check-type:
>
> (defun (string-to-integer INTEGER) ((string STRING))
>   :documentation "Convert the 'string' representation of an integer  
> into an
> integer and return the result."
>   :public? TRUE
>   (return (verbatim :common-lisp
>              "(CL:LET ((i (CL:parse-integer string)))
>      (CL:CHECK-TYPE i CL:INTEGER)
>      i)"
>              :otherwise NULL)))
>
>
> Then, I can evaluate the initial string-to-integer form.
>
> As I said, I'm new to clisp. So please forgive me if I'm making a  
> big mistake.

This will be a big mistake because PowerLoom, for efficiency reasons,  
declares all of the integers to be of type fixnum.  The STRING-TO- 
INTEGER function tests that as a safety measure, since not all Lisp  
systems use the same size integers.

So if you disable this type check, it will mean that sometime down  
the road, anything that uses the hash codes for goal caches will  
likely break, since the value it gets will be a full integer and not  
a fixnum, and they are represented differently internally.

A better fix would be to change the number in goal-caches.lisp to be  
smaller, like 8312004 instead.

> What can I do to make it run with CLISP on Windows?

Unfortunately, you may run into problems running PowerLoom with CLISP.

CLISP on Windows (and Unix, too) unfortunately has a very small  
FIXNUM size.  We have been able to change that, (which is also an  
issue for LispWorks for Windows, but not Unix).

But there is another more fundamental problem that has to do with the  
way the empty list prints.  For our Stella code we need to have the  
empty list print as () instead of NIL, and there is no way to do that  
for CLISP.  This limits your ability to write and translate Stella  
code using CLISP, since empty lists will not print in a way that we  
can parse them.  The pre-translated Lisp files, though, do work  
properly and you can get this to work if you get one of the newer  
versions of the code.  Look at the link

I do have some changes that allow running PowerLoom in CLISP (and  
LispWorks) with 24-bit FIXNUMs, but they haven't been committed yet.   
I just added them, so if all goes well, the next patch update should  
build
automatically tonight and be available.  I'll check tomorrow and let  
you know.


PowerLoom runs quite slowly in CLISP.  Other Lisp implementations are  
much faster for PowerLoom.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.