Changeset 3761


Ignore:
Timestamp:
09/14/03 15:33:05 (19 years ago)
Author:
piso
Message:

numberp()

Location:
trunk/j/src/org/armedbear/lisp
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Bignum.java

    r3759 r3761  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Bignum.java,v 1.37 2003-09-14 15:08:42 piso Exp $
     5 * $Id: Bignum.java,v 1.38 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7070    }
    7171
     72    public boolean numberp()
     73    {
     74        return true;
     75    }
     76
    7277    public boolean integerp()
    7378    {
     
    267272        if (obj instanceof LispFloat)
    268273            return floatValue() == ((LispFloat)obj).getValue();
    269         if ((obj.getType() & TYPE_NUMBER) != 0)
     274        if (obj.numberp())
    270275            return false;
    271276        throw new TypeError(obj, "number");
     
    278283        if (obj instanceof LispFloat)
    279284            return floatValue() != ((LispFloat)obj).getValue();
    280         if ((obj.getType() & TYPE_NUMBER) != 0)
     285        if (obj.numberp())
    281286            return true;
    282287        throw new TypeError(obj, "number");
  • trunk/j/src/org/armedbear/lisp/Complex.java

    r3759 r3761  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Complex.java,v 1.17 2003-09-14 15:11:07 piso Exp $
     5 * $Id: Complex.java,v 1.18 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8181    }
    8282
     83    public boolean numberp()
     84    {
     85        return true;
     86    }
     87
    8388    public boolean eql(LispObject obj)
    8489    {
     
    175180                    imagpart.isEqualTo(c.imagpart));
    176181        }
    177         if ((obj.getType() & TYPE_NUMBER) != 0) {
     182        if (obj.numberp()) {
    178183            // obj is a number, but not complex.
    179184            if (imagpart instanceof LispFloat) {
  • trunk/j/src/org/armedbear/lisp/Fixnum.java

    r3759 r3761  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Fixnum.java,v 1.63 2003-09-14 15:07:41 piso Exp $
     5 * $Id: Fixnum.java,v 1.64 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7777    {
    7878        return T;
     79    }
     80
     81    public boolean numberp()
     82    {
     83        return true;
    7984    }
    8085
     
    335340        if (obj instanceof Complex)
    336341            return obj.isEqualTo(this);
    337         if ((obj.getType() & TYPE_NUMBER) != 0)
     342        if (obj.numberp())
    338343            return false;
    339344        throw new TypeError(obj, "number");
     
    349354        if (obj instanceof Complex)
    350355            return obj.isNotEqualTo(this);
    351         if ((obj.getType() & TYPE_NUMBER) != 0)
     356        if (obj.numberp())
    352357            return true;
    353358        throw new TypeError(obj, "number");
  • trunk/j/src/org/armedbear/lisp/LispFloat.java

    r3759 r3761  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispFloat.java,v 1.39 2003-09-14 15:08:09 piso Exp $
     5 * $Id: LispFloat.java,v 1.40 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7171    {
    7272        return T;
     73    }
     74
     75    public boolean numberp()
     76    {
     77        return true;
    7378    }
    7479
  • trunk/j/src/org/armedbear/lisp/LispObject.java

    r3759 r3761  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispObject.java,v 1.48 2003-09-14 15:07:02 piso Exp $
     5 * $Id: LispObject.java,v 1.49 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    184184    }
    185185
     186    public boolean numberp()
     187    {
     188        return false;
     189    }
     190
    186191    public LispObject ZEROP() throws TypeError
    187192    {
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r3760 r3761  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.391 2003-09-14 15:11:43 piso Exp $
     5 * $Id: Primitives.java,v 1.392 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    46694669            if (arg instanceof Complex)
    46704670                return ((Complex)arg).getRealPart();
    4671             if ((arg.getType() & TYPE_NUMBER) != 0)
     4671            if (arg.numberp())
    46724672                return arg;
    46734673            throw new TypeError(arg, "number");
  • trunk/j/src/org/armedbear/lisp/Ratio.java

    r3759 r3761  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Ratio.java,v 1.29 2003-09-14 15:09:05 piso Exp $
     5 * $Id: Ratio.java,v 1.30 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8383    }
    8484
     85    public boolean numberp()
     86    {
     87        return true;
     88    }
     89
    8590    public boolean eql(LispObject obj)
    8691    {
     
    264269        if (obj instanceof LispFloat)
    265270            return floatValue() == ((LispFloat)obj).getValue();
    266         if ((obj.getType() & TYPE_NUMBER) != 0)
     271        if (obj.numberp())
    267272            return false;
    268273        throw new TypeError(obj, "number");
  • trunk/j/src/org/armedbear/lisp/coerce.java

    r3465 r3761  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: coerce.java,v 1.5 2003-08-23 01:35:25 piso Exp $
     5 * $Id: coerce.java,v 1.6 2003-09-14 15:33:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5151            }
    5252            if (second == Symbol.COMPLEX) {
    53                 if ((first.getType() & TYPE_NUMBER) != 0) {
     53                if (first.numberp()) {
    5454                    if (first instanceof LispFloat)
    5555                        return Complex.getInstance(first, LispFloat.ZERO);
Note: See TracChangeset for help on using the changeset viewer.