Changeset 11710


Ignore:
Timestamp:
03/15/09 15:08:26 (13 years ago)
Author:
ehuelsmann
Message:

Implement a generic 'list()' function instead of 9 ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/Lisp.java

    r11700 r11710  
    592592  }
    593593
    594   public static final Cons list(LispObject... objects)
    595   {
    596     Cons theList = new Cons(objects[objects.length-1]);
    597     for (int i = objects.length - 2; i >= 0; i--)
    598         theList = new Cons(objects[i], theList);
    599     return theList;
    600   }
    601 
     594
     595  public static final Cons list(LispObject obj1, LispObject... remaining)
     596  {
     597    Cons theList = null;
     598    if (remaining.length > 0) {
     599      theList = new Cons(remaining[remaining.length-1]);
     600      for (int i = remaining.length - 2; i >= 0; i--)
     601        theList = new Cons(remaining[i], theList);
     602    }
     603    return (theList == null) ? new Cons(obj1) : new Cons(obj1, theList);
     604  }
     605
     606  @Deprecated
    602607  public static final Cons list1(LispObject obj1)
    603608  {
     
    605610  }
    606611
     612  @Deprecated
    607613  public static final Cons list2(LispObject obj1, LispObject obj2)
    608614  {
     
    610616  }
    611617
     618  @Deprecated
    612619  public static final Cons list3(LispObject obj1, LispObject obj2,
    613620                                 LispObject obj3)
     
    616623  }
    617624
     625  @Deprecated
    618626  public static final Cons list4(LispObject obj1, LispObject obj2,
    619627                                 LispObject obj3, LispObject obj4)
     
    625633  }
    626634
     635  @Deprecated
    627636  public static final Cons list5(LispObject obj1, LispObject obj2,
    628637                                 LispObject obj3, LispObject obj4,
     
    636645  }
    637646
     647  @Deprecated
    638648  public static final Cons list6(LispObject obj1, LispObject obj2,
    639649                                 LispObject obj3, LispObject obj4,
     
    648658  }
    649659
     660  @Deprecated
    650661  public static final Cons list7(LispObject obj1, LispObject obj2,
    651662                                 LispObject obj3, LispObject obj4,
     
    662673  }
    663674
     675  @Deprecated
    664676  public static final Cons list8(LispObject obj1, LispObject obj2,
    665677                                 LispObject obj3, LispObject obj4,
     
    677689  }
    678690
     691  @Deprecated
    679692  public static final Cons list9(LispObject obj1, LispObject obj2,
    680693                                 LispObject obj3, LispObject obj4,
Note: See TracChangeset for help on using the changeset viewer.