Is %i an integer? - Adding more facts to the database



Am Sonntag, den 28.06.2009, 22:53 +0100 schrieb Leo Butler:
> < Therefore, from the viewpoint of the implemented function featurep a symbol
> < which is declared to be real is also a noninteger.
> < 
> 
> Not exactly.
> 
> < For the practical aim of programming it is necessary to have a convention which
> < will work. We might change the behavior of featurep or we might use it as it is
> < and document the behavior better.
>  
> It seems to me that there is a convention and it is reasonable:
> if x is declared to be in a set, but not explicitly declared to be
> in a subset, then it is assumed not to be in the subset.
> 
> The only other convention would be to respond 'unknown'. This would
> require one to ask for clarification or handle each case (t/f).
> 
> I think it would be more sensible to introduce, for each type, its
> negation. At the moment, we have this for even/odd and
> rational/irrational.

My first idea was to implement the pair integer/noninteger the same way
as the pair rational/irrational. When we do this, we have to change the
function nonintegerp as a consequence.

We can do it another way:

We do not change the implementation of noninteger. Then we can implement
the following declarations:

  (kind $%i $imaginary)
  (kind $%i $noninteger)

  (kind $%pi $real)
  (kind $%pi $noninteger)

And we will get again:

(%i7) askinteger(%i);
(%o7)                                 no
(%i8) askinteger(%pi);
(%o8)                                 no

Then we should discuss if the implementation of the pair
rational/irrational is consistent with this solution.

Dieter Kaiser