static Cons MapVectorToList1(object functionSpecifier, object [] sequence) { Delegate function = ResolveFunctionSpecifier(functionSpecifier); Cons answer = null; foreach (object element in sequence) { answer = Cons(function.DynamicInvoke(element), answer); } return((Cons)CL.Reverse(answer)); }
static System.Collections.Generic.IList <T> MapVectorToList1 <I, T> (object functionSpecifier, I [] sequence) { Delegate function = ResolveFunctionSpecifier(functionSpecifier); ConsCollection <T> answer = null; foreach (I element in sequence) { answer = new ConsCollection <T> ((T)function.DynamicInvoke(element), answer); } return(CL.Reverse <T> (answer)); }
static System.Collections.Generic.IList <T> MapCollectionToList1 <T> (object functionSpecifier, ICollection sequence) { Delegate function = ResolveFunctionSpecifier(functionSpecifier); ConsCollection <T> reverseAnswer = null; foreach (object element in sequence) { T item = (T)function.DynamicInvoke(element); reverseAnswer = new ConsCollection <T> (item, reverseAnswer); } return(CL.Reverse <T> (reverseAnswer)); }
static public Cons RemArgs(object [] ra, object key) { Cons reversedAnswer = null; for (int i = 0; i < ra.Length; i += 2) { if (ra [i] != key) { reversedAnswer = new Cons(ra [i + 1], new Cons(ra [i], reversedAnswer)); } } return(CL.Reverse(reversedAnswer)); }
static public ConsCollection <O> Mapcar <O, I> (object functionSpecifier, System.Collections.Generic.ICollection <I> input) { if (input == null) { return(null); } Function1 <O, I> function = ResolveFunctionSpecifier <Function1 <O, I> > (functionSpecifier); ConsCollection <O> answer = null; foreach (I element in input) { answer = new ConsCollection <O> (function(element), answer); } return(CL.Reverse(answer)); }
static public ConsCollection <T> RemoveDuplicates <T> (System.Collections.Generic.IList <T> list) { if (list == null) { return(null); } ConsCollection <T> answer = null; foreach (T element in list) { if ((answer == null) || !((System.Collections.Generic.IList <T>)answer).Contains(element)) { answer = new ConsCollection <T> (element, answer); } } return(CL.Reverse(answer)); }
static Cons Evlis(object formlist) { Cons evaluated = null; while (true) { Cons formpair = formlist as Cons; if (formpair != null) { evaluated = new Cons(Eval(formpair.Car), evaluated); formlist = formpair.Cdr; } else if (formpair == null) { return((Cons)CL.Reverse(evaluated)); } else { throw new NotImplementedException(); } } }
static System.Collections.Generic.IList <T> MapListToList1 <I, T> (object functionSpecifier, ConsCollection <I> sequence) { Delegate function = ResolveFunctionSpecifier(functionSpecifier); ConsCollection <T> answer = null; while (sequence != null) { answer = new ConsCollection <T> ((T)function.DynamicInvoke(sequence.Car), answer); object temp = sequence.Cdr; if (temp == null) { break; } ConsCollection <I> next = temp as ConsCollection <I>; if (next == null) { throw new NotImplementedException(); } sequence = next; } return(CL.Reverse <T> (answer)); }
static Cons MapListToList1(object functionSpecifier, Cons sequence) { Delegate function = ResolveFunctionSpecifier(functionSpecifier); Cons answer = null; while (sequence != null) { answer = new Cons(function.DynamicInvoke(sequence.Car), answer); object temp = sequence.Cdr; if (temp == null) { break; } Cons next = temp as Cons; if (next == null) { throw new NotImplementedException(); } sequence = next; } return((Cons)CL.Reverse(answer)); }
public static ConsCollection <T> Append <T> (System.Collections.Generic.IList <T> left, ConsCollection <T> right) { return(CL.Reconc <T> (CL.Reverse <T> (left), right)); }
// Append public static object Append(object left, object right) { return(CL.Reconc(CL.Reverse(left), right)); }