Ejemplo n.º 1
0
Archivo: Repl.cs Proyecto: CHNB128/GCL
        static eValue ParseAST(eValue ast, Env env)
        {
            if (ast is eSymbol)
            {
                return(env.get((eSymbol)ast));
            }
            else if (ast is eList)
            {
                eList oldList = (eList)ast;
                eList newList = ast.list_Q() ? new eList() : (eList) new eVector();

                foreach (eValue mv in oldList.getValue())
                {
                    newList.conj_BANG(Eval(mv, env));
                }

                return(newList);
            }
            else if (ast is eHashMap)
            {
                var hashMap = new Dictionary <string, eValue>();

                foreach (var entry in ((eHashMap)ast).getValue())
                {
                    hashMap.Add(entry.Key, Eval((eValue)entry.Value, env));
                }

                return(new eHashMap(hashMap));
            }
            else
            {
                return(ast);
            }
        }
Ejemplo n.º 2
0
 public static string _pr_str_args(eList args, String sep, bool print_readably)
 {
     return(join(args.getValue(), sep, print_readably));
 }