Changeset 3529


Ignore:
Timestamp:
08/26/03 16:18:01 (20 years ago)
Author:
piso
Message:

incr(), decr()

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

Legend:

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

    r3526 r3529  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Bignum.java,v 1.26 2003-08-26 14:38:16 piso Exp $
     5 * $Id: Bignum.java,v 1.27 2003-08-26 16:18:01 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    143143    public final LispObject incr()
    144144    {
    145         return new Bignum(value.add(BigInteger.ONE));
     145        return number(value.add(BigInteger.ONE));
    146146    }
    147147
    148148    public final LispObject decr()
    149149    {
    150         return new Bignum(value.subtract(BigInteger.ONE));
     150        return number(value.subtract(BigInteger.ONE));
    151151    }
    152152
  • trunk/j/src/org/armedbear/lisp/Complex.java

    r3414 r3529  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Complex.java,v 1.10 2003-08-15 17:18:02 piso Exp $
     5 * $Id: Complex.java,v 1.11 2003-08-26 16:17:20 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    9797    }
    9898
     99    public final LispObject incr() throws LispError
     100    {
     101        return new Complex(realpart.add(Fixnum.ONE), imagpart);
     102    }
     103
     104    public final LispObject decr() throws LispError
     105    {
     106        return new Complex(realpart.subtract(Fixnum.ONE), imagpart);
     107    }
     108
    99109    public LispObject add(LispObject obj) throws LispError
    100110    {
  • trunk/j/src/org/armedbear/lisp/LispFloat.java

    r3526 r3529  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispFloat.java,v 1.30 2003-08-26 14:38:16 piso Exp $
     5 * $Id: LispFloat.java,v 1.31 2003-08-26 16:17:37 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    137137    {
    138138        return value;
     139    }
     140
     141    public final LispObject incr()
     142    {
     143        return new LispFloat(value + 1);
     144    }
     145
     146    public final LispObject decr()
     147    {
     148        return new LispFloat(value - 1);
    139149    }
    140150
  • trunk/j/src/org/armedbear/lisp/Ratio.java

    r3526 r3529  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Ratio.java,v 1.21 2003-08-26 14:38:16 piso Exp $
     5 * $Id: Ratio.java,v 1.22 2003-08-26 16:16:58 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    133133    {
    134134        return numerator.floatValue() / denominator.floatValue();
     135    }
     136
     137    public final LispObject incr() throws LispError
     138    {
     139        return new Ratio(numerator.add(denominator), denominator);
     140    }
     141
     142    public final LispObject decr() throws LispError
     143    {
     144        return new Ratio(numerator.subtract(denominator), denominator);
    135145    }
    136146
Note: See TracChangeset for help on using the changeset viewer.