CSScheme.Primitive.map C# (CSharp) Метод

map() статический приватный Метод

static private map ( Procedure proc, Object args, Scheme interp, Pair result ) : Pair
proc Procedure
args Object
interp Scheme
result Pair
Результат Pair
        static Pair map(Procedure proc, Object args, Scheme interp, Pair result)
        {
            Pair accum = result;
            if (rest(args) == null)
            {
                args = first(args);
                while (args is Pair)
                {
                    Object x = proc.apply(interp, list(first(args)));
                    if (accum != null) accum = (Pair) (accum.rest = list(x));
                    args = rest(args);
                }
            }
            else
            {
                Procedure car = Procedure.proc(interp.eval("car"));
                Procedure cdr = Procedure.proc(interp.eval("cdr"));
                while  (first(args) is Pair)
                {
                    Object x = proc.apply(interp, map(car, list(args), interp, list(null)));
                    if (accum != null) accum = (Pair) (accum.rest = list(x));
                    args = map(cdr, list(args), interp, list(null));
                }
            }
            return (Pair)rest(result);
        }