Example #1
0
        public static Object For(Cons args, Environment environment)
        {
            //string v = "//(for " + Printer.ConsToString(args) + ")" + NewLine + "{" + NewLine;
            string      v = "{" + NewLine;
            Environment localEnvironment = new Environment(environment);

            v += Generate(args.First(), localEnvironment);
            v += Generate(args.Second(), localEnvironment);
            v += @"while ((Conversions.ObjectToBoolean(retval)) 
{
";
            foreach (object item in (Cons)args.Cdddr())
            {
                v += Generate(item, localEnvironment);
            }

            v += Generate(args.Third(), localEnvironment);

            v += Generate(args.Second(), localEnvironment);

            v += @"}
";
            return(v + "}" + NewLine);
        }