[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] numberOfEmptySlots
From: |
Waldek Hebisch |
Subject: |
Re: [Axiom-developer] numberOfEmptySlots |
Date: |
Sat, 15 Sep 2007 16:30:03 +0200 (CEST) |
>
> Consider the following function from src/interp/clam.boot:
>
> numberOfEmptySlots cache==
> count:= (CAAR cache ='$failed => 1; 0)
> for x in tails rest cache while NE(x,cache) repeat
> if CAAR x='$failed then count:= count+1
> count
>
>
> The SBCL type checker does not like it because:
>
> * it is able to infer that cache is a list,
> * '=' (coming from NE, which mean not =) can be applied only
> to numbers.
>
> Consequently, we have conflicting assumptions for the same value. So, we
> have a bug. Now, looking back at the code, the expression
>
> NE(x,cache)
>
> cannot be right. Was it indended to be
>
> x /= cache
>
> instead?
>
> Note: a /= b is almost same like (not (equal a b)).
>
The problem is due to incomplete conversion form old Boot to Shoe.
Originally clam.boot was translated by old Boot and NE was passed
unmolested to Lisp output. In vmlisp.lisp we have:
(defmacro ne (a b) `(not (equal ,a ,b)))
so original meaning was (not (equal x cache)). Shoe changes
NE to /= leading to error...
--
Waldek Hebisch
address@hidden
- Re: [Axiom-developer] numberOfEmptySlots,
Waldek Hebisch <=