Ejemplo n.º 1
0
        public static Object Nconc(Cons args, Environment environment)
        {
            // With no argument, returns null
            if (args == null)
            {
                return(null);
            }

            // With one argument, returns that argument
            if (args.Length() < 2)
            {
                return(args.First());
            }

            for (int i = 0; i < args.Length() - 1; i++)
            {
                Cons cons = (Cons)args.Nth(i);
                cons = (Cons)cons.Last();
                cons.Rplacd(args.Nth(i + 1));
            }

            return(args.First());
        }