Changeset 4673


Ignore:
Timestamp:
11/07/03 20:19:49 (18 years ago)
Author:
piso
Message:

getf()

File:
1 edited

Legend:

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

    r4672 r4673  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.173 2003-11-07 19:52:10 piso Exp $
     5 * $Id: Lisp.java,v 1.174 2003-11-07 20:19:49 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    976976
    977977    // Property lists.
     978    public static final LispObject getf(LispObject plist, LispObject indicator,
     979                                        LispObject defaultValue)
     980        throws ConditionThrowable
     981    {
     982        LispObject list = plist;
     983        while (list != NIL) {
     984            if (list.car() == indicator)
     985                return list.cadr();
     986            if (list.cdr() instanceof Cons)
     987                list = list.cddr();
     988            else
     989                throw new ConditionThrowable(new TypeError("malformed property list: " + plist));
     990        }
     991        return defaultValue;
     992    }
     993
    978994    public static final LispObject get(Symbol symbol, LispObject indicator,
    979995                                       LispObject defaultValue)
Note: See TracChangeset for help on using the changeset viewer.