public object Setq(Symbol id, object value) { ILocation<object> binding; if (!variables.TryGetValue (id, out binding)) Bind (id, Namespace.Variable, new ValueCell<object> (value)); else binding.Value = value; return value; }
public void Bind(Symbol id, Namespace nspace, ILocation<Object> location) { switch (nspace) { case Namespace.Variable: variables.Add(id, location); break; default: throw new NotImplementedException (); } }
public Delegate SymbolFunction(Symbol id) { ILocation<Delegate> binding; if (functions.TryGetValue (id, out binding)) return binding.Value; if (id.NamesDotnetMethod ()) { Delegate gf = (Delegate) CL.EnsureGenericFunction (id, KW.GenericFunctionClass, CLOS.DotnetGenericFunction, KW.Environment, this, KW.StudlyName, id.Name); binding = new ValueCell<Delegate> (gf); return binding.Value; } else throw new NotImplementedException (); }
public object SymbolValue(Symbol id) { ILocation<object> binding; if (variables.TryGetValue (id, out binding)) return binding.Value; else throw new NotImplementedException (); }
public bool IsFbound(Symbol id) { return functions.ContainsKey (id); }
public bool IsBound(Symbol id) { return variables.ContainsKey (id); }
public virtual Symbol Intern(string name) { if (name == null) throw new ArgumentNullException ("name"); Predicate<Symbol> matchString = new Predicate<Symbol> (new StringMatcher (name).MatchesSymbol); Symbol probe = this.PresentSymbolList.Find (matchString); if (probe != null) return probe; else { foreach (Package u in this.PackageUseList) { probe = u.ExternalSymbolList.Find (matchString); if (probe != null) return probe; } probe = new Symbol (name, this); this.PresentSymbolList.Add (probe); return probe; } }
public void Export(Symbol sym) { if (this.ExternalSymbolList.Contains (sym)) return; this.ExternalSymbolList.Add (sym); }
public bool MatchesSymbol(Symbol s) { return s.Name == this.ToMatch; }