Changeset 5257


Ignore:
Timestamp:
12/27/03 04:29:45 (17 years ago)
Author:
piso
Message:

bindFunctional(), lookupFunctional(): support SETF functions.

File:
1 edited

Legend:

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

    r5127 r5257  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Environment.java,v 1.9 2003-12-14 17:12:28 piso Exp $
     5 * $Id: Environment.java,v 1.10 2003-12-27 04:29:45 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8080
    8181    // Functional bindings.
    82     public void bindFunctional(Symbol symbol, LispObject value)
     82    public void bindFunctional(LispObject name, LispObject value)
    8383    {
    84         functions = new Binding(symbol, value, functions);
     84        functions = new Binding(name, value, functions);
    8585    }
    8686
    87     public LispObject lookupFunctional(LispObject symbol)
     87    public LispObject lookupFunctional(LispObject name)
    8888        throws ConditionThrowable
    8989    {
    9090        Binding binding = functions;
    91         while (binding != null) {
    92             if (binding.symbol == symbol)
    93                 return binding.value;
    94             binding = binding.next;
     91        if (name instanceof Symbol) {
     92            while (binding != null) {
     93                if (binding.symbol == name)
     94                    return binding.value;
     95                binding = binding.next;
     96            }
     97            // Not found in environment.
     98            return name.getSymbolFunction();
    9599        }
    96         // Not found in environment.
    97         return symbol.getSymbolFunction();
     100        if (name instanceof Cons) {
     101            while (binding != null) {
     102                if (binding.symbol.equal(name))
     103                    return binding.value;
     104                binding = binding.next;
     105            }
     106        }
     107        return null;
    98108    }
    99109
Note: See TracChangeset for help on using the changeset viewer.