Changeset 4766


Ignore:
Timestamp:
11/15/03 15:26:36 (18 years ago)
Author:
piso
Message:

MEMQL

File:
1 edited

Legend:

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

    r4277 r4766  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Extensions.java,v 1.15 2003-10-10 02:57:39 piso Exp $
     5 * $Id: Extensions.java,v 1.16 2003-11-15 15:26:36 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2626public final class Extensions extends Lisp
    2727{
    28     // memq item list &key key test test-not => tail
     28    // memq item list => tail
    2929    private static final Primitive2 MEMQ =
    3030        new Primitive2("memq", PACKAGE_EXT, true)
     
    3636            while (tail != NIL) {
    3737                if (item == tail.car())
     38                    return tail;
     39                tail = tail.cdr();
     40            }
     41            return NIL;
     42        }
     43    };
     44
     45    // memql item list => tail
     46    private static final Primitive2 MEMQL =
     47        new Primitive2("memql", PACKAGE_EXT, true)
     48    {
     49        public LispObject execute(LispObject item, LispObject list)
     50            throws ConditionThrowable
     51        {
     52            LispObject tail = checkList(list);
     53            while (tail != NIL) {
     54                if (item.eql(tail.car()))
    3855                    return tail;
    3956                tail = tail.cdr();
Note: See TracChangeset for help on using the changeset viewer.