Changeset 5004


Ignore:
Timestamp:
12/07/03 17:28:04 (18 years ago)
Author:
piso
Message:

SECOND, THIRD, FOURTH => cxr.java

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

Legend:

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

    r5003 r5004  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.510 2003-12-07 17:03:37 piso Exp $
     5 * $Id: Primitives.java,v 1.511 2003-12-07 17:27:33 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5151    private static final int CONSP                      = 17;
    5252    private static final int EVAL                       = 18;
    53     private static final int FOURTH                     = 19;
    5453    private static final int IDENTITY                   = 20;
    5554    private static final int KEYWORDP                   = 21;
     
    5958    private static final int MAKUNBOUND                 = 25;
    6059    private static final int PREDECESSOR                = 26;
    61     private static final int SECOND                     = 27;
    6260    private static final int SIMPLE_BIT_VECTOR_P        = 28;
    6361    private static final int SIMPLE_STRING_P            = 29;
     
    6967    private static final int SYMBOL_PACKAGE             = 35;
    7068    private static final int SYMBOL_PLIST               = 36;
    71     private static final int THIRD                      = 37;
    7269    private static final int UPPER_CASE_P               = 38;
    7370    private static final int VECTORP                    = 39;
     
    9693        definePrimitive1("consp", CONSP);
    9794        definePrimitive1("eval", EVAL);
    98         definePrimitive1("fourth", FOURTH);
    9995        definePrimitive1("identity", IDENTITY);
    10096        definePrimitive1("keywordp", KEYWORDP);
     
    10399        definePrimitive1("make-symbol", MAKE_SYMBOL);
    104100        definePrimitive1("makunbound", MAKUNBOUND);
    105         definePrimitive1("second", SECOND);
    106101        definePrimitive1("simple-bit-vector-p", SIMPLE_BIT_VECTOR_P);
    107102        definePrimitive1("simple-string-p", SIMPLE_STRING_P);
     
    112107        definePrimitive1("symbol-package", SYMBOL_PACKAGE);
    113108        definePrimitive1("symbol-plist", SYMBOL_PLIST);
    114         definePrimitive1("third", THIRD);
    115109        definePrimitive1("upper-case-p", UPPER_CASE_P);
    116110        definePrimitive1("vectorp", VECTORP);
     
    175169            case IDENTITY:                      // ### identity
    176170                return arg;
    177             case SECOND:                        // ### second
    178                 return arg.cadr();
    179             case THIRD:                         // ### third
    180                 return arg.cdr().cdr().car();
    181             case FOURTH:                        // ### fourth
    182                 return arg.cdr().cdr().cdr().car();
    183171            case COMPILED_FUNCTION_P:           // ### compiled-function-p
    184172                return arg.typep(Symbol.COMPILED_FUNCTION);
  • trunk/j/src/org/armedbear/lisp/cxr.java

    r3883 r5004  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: cxr.java,v 1.3 2003-09-19 01:46:42 piso Exp $
     5 * $Id: cxr.java,v 1.4 2003-12-07 17:28:04 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2626    // ### %rplaca
    2727    private static final Primitive2 _RPLACA =
    28         new Primitive2("%rplaca", PACKAGE_SYS, false) {
     28        new Primitive2("%rplaca", PACKAGE_SYS, false)
     29    {
    2930        public LispObject execute(LispObject first, LispObject second)
    3031            throws ConditionThrowable
     
    3738    // ### %rplacd
    3839    private static final Primitive2 _RPLACD =
    39         new Primitive2("%rplacd", PACKAGE_SYS, false) {
     40        new Primitive2("%rplacd", PACKAGE_SYS, false)
     41    {
    4042        public LispObject execute(LispObject first, LispObject second)
    4143            throws ConditionThrowable
     
    4749
    4850    // ### car
    49     private static final Primitive1 CAR = new Primitive1("car") {
     51    private static final Primitive1 CAR = new Primitive1("car")
     52    {
    5053        public LispObject execute(LispObject arg) throws ConditionThrowable
    5154        {
     
    5558
    5659    // ### cdr
    57     private static final Primitive1 CDR = new Primitive1("cdr") {
     60    private static final Primitive1 CDR = new Primitive1("cdr")
     61    {
    5862        public LispObject execute(LispObject arg) throws ConditionThrowable
    5963        {
     
    6367
    6468    // ### caar
    65     private static final Primitive1 CAAR = new Primitive1("caar") {
     69    private static final Primitive1 CAAR = new Primitive1("caar")
     70    {
    6671        public LispObject execute(LispObject arg) throws ConditionThrowable
    6772        {
     
    7176
    7277    // ### cadr
    73     private static final Primitive1 CADR = new Primitive1("cadr") {
     78    private static final Primitive1 CADR = new Primitive1("cadr")
     79    {
    7480        public LispObject execute(LispObject arg) throws ConditionThrowable
    7581        {
     
    7985
    8086    // ### cdar
    81     private static final Primitive1 CDAR = new Primitive1("cdar") {
     87    private static final Primitive1 CDAR = new Primitive1("cdar")
     88    {
    8289        public LispObject execute(LispObject arg) throws ConditionThrowable
    8390        {
     
    8794
    8895    // ### cddr
    89     private static final Primitive1 CDDR = new Primitive1("cddr") {
     96    private static final Primitive1 CDDR = new Primitive1("cddr")
     97    {
    9098        public LispObject execute(LispObject arg) throws ConditionThrowable
    9199        {
     
    95103
    96104    // ### caddr
    97     private static final Primitive1 CADDR = new Primitive1("caddr") {
     105    private static final Primitive1 CADDR = new Primitive1("caddr")
     106    {
    98107        public LispObject execute(LispObject arg) throws ConditionThrowable
    99108        {
     
    103112
    104113    // ### caadr
    105     private static final Primitive1 CAADR = new Primitive1("caadr") {
     114    private static final Primitive1 CAADR = new Primitive1("caadr")
     115    {
    106116        public LispObject execute(LispObject arg) throws ConditionThrowable
    107117        {
     
    111121
    112122    // ### caaar
    113     private static final Primitive1 CAAAR = new Primitive1("caaar") {
     123    private static final Primitive1 CAAAR = new Primitive1("caaar")
     124    {
    114125        public LispObject execute(LispObject arg) throws ConditionThrowable
    115126        {
     
    119130
    120131    // ### cdaar
    121     private static final Primitive1 CDAAR = new Primitive1("cdaar") {
     132    private static final Primitive1 CDAAR = new Primitive1("cdaar")
     133    {
    122134        public LispObject execute(LispObject arg) throws ConditionThrowable
    123135        {
     
    127139
    128140    // ### cddar
    129     private static final Primitive1 CDDAR = new Primitive1("cddar") {
     141    private static final Primitive1 CDDAR = new Primitive1("cddar")
     142    {
    130143        public LispObject execute(LispObject arg) throws ConditionThrowable
    131144        {
     
    135148
    136149    // ### cdddr
    137     private static final Primitive1 CDDDR = new Primitive1("cdddr") {
     150    private static final Primitive1 CDDDR = new Primitive1("cdddr")
     151    {
    138152        public LispObject execute(LispObject arg) throws ConditionThrowable
    139153        {
     
    143157
    144158    // ### cadar
    145     private static final Primitive1 CADAR = new Primitive1("cadar") {
     159    private static final Primitive1 CADAR = new Primitive1("cadar")
     160    {
    146161        public LispObject execute(LispObject arg) throws ConditionThrowable
    147162        {
     
    151166
    152167    // ### cdadr
    153     private static final Primitive1 CDADR = new Primitive1("cdadr") {
     168    private static final Primitive1 CDADR = new Primitive1("cdadr")
     169    {
    154170        public LispObject execute(LispObject arg) throws ConditionThrowable
    155171        {
     
    159175
    160176    // ### first
    161     private static final Primitive1 FIRST = new Primitive1("first") {
     177    private static final Primitive1 FIRST = new Primitive1("first")
     178    {
    162179        public LispObject execute(LispObject arg) throws ConditionThrowable
    163180        {
     
    166183    };
    167184
     185    // ### second
     186    private static final Primitive1 SECOND = new Primitive1("second")
     187    {
     188        public LispObject execute(LispObject arg) throws ConditionThrowable
     189        {
     190            return arg.cadr();
     191        }
     192    };
     193
     194    // ### third
     195    private static final Primitive1 THIRD = new Primitive1("third")
     196    {
     197        public LispObject execute(LispObject arg) throws ConditionThrowable
     198        {
     199            return arg.cdr().cdr().car();
     200        }
     201    };
     202
     203    // ### fourth
     204    private static final Primitive1 FOURTH = new Primitive1("fourth")
     205    {
     206        public LispObject execute(LispObject arg) throws ConditionThrowable
     207        {
     208            return arg.cdr().cdr().cdr().car();
     209        }
     210    };
     211
    168212    // ### rest
    169     private static final Primitive1 REST = new Primitive1("rest") {
     213    private static final Primitive1 REST = new Primitive1("rest")
     214    {
    170215        public LispObject execute(LispObject arg) throws ConditionThrowable
    171216        {
Note: See TracChangeset for help on using the changeset viewer.