public ILispNode Clone() { var result = new LispList(); ForEach(x => result.Add(x.Clone())); return(result); }
public LispList(LispList parent) { Parent = parent; if (Parent != null) { Parent.Add(this); } }
public LispAtom(LispList parent, string tokenValue, Token token) { Parent = parent; TokenValue = tokenValue; Token = token; SetValue(tokenValue as object); if (Parent != null) { Parent.Add(this); } }
public ILispNode Eval(CallStack callStack, params object [] args) { try { // () if (Count == 0) { return(_nil); } var functor = this[0].Eval(callStack, false); // ( =>nil ) if (functor is LispNil) { return(_nil); } // ( =>missing ) if (functor is LispMissing) { return(functor); } var arguments = new LispList(); do { if (IsImproperList) { arguments.Add(this[1] as LispAtom); continue; } arguments = new LispList(null, this.Skip(1)); }while (false); // ( =>(lambda) ) and ( =>'funcname' ) return(Functor.Apply(functor, arguments, callStack, args)); } catch (LispException) { throw; } catch (Exception ex) { throw new LispException(this, "Exception while applying functor to arguments", ex); } }