private LispList append(LispList list, List <LispDataType> values) { if (values.Count == 0) { return(new LispList(list)); } if (list.IsDotted) { throw new LispException(string.Format(ERR_INVALID_LIST_ENDING, list.Last())); } List <LispDataType> evaluatedData = new List <LispDataType>(values); LispList result = new LispList(list); if (values.First().Evaluate(this) is LispList) { // TODO: ADDRANGE AND VALUES NOT BEING COPIED? result.Data.AddRange(((LispList)values.First().Evaluate(this)).Data); result.IsDotted = list.IsDotted; } else { result.Data.Add(values.First().Evaluate(this)); result.IsDotted = true; } result.SetLiteral(true); return(append(result, values.GetRange(1, values.Count - 1))); }
private LispList makeList(LispDataType data) { LispList result = new LispList(); result.Data.Add(data); result.SetLiteral(true); return(result); }
private LispDataType last(LispList list) { LispList result = new LispList(list); result.Data.RemoveRange(0, result.Data.Count - 1); result.SetLiteral(true); result.IsDotted = list.IsDotted; return(result); }