private void DefinePrimitives(Environment env) { foreach (KeyValuePair<string, Primitive> kvp in PrimitiveFactory.Primitives) { ScheminAtom symbol = new ScheminAtom(kvp.Key); ScheminPrimitive prim = new ScheminPrimitive(kvp.Key); env.AddBinding(symbol, prim); } var prebound_schemin = new List<string>(); prebound_schemin.Add(ScheminPrimitives.Map); prebound_schemin.Add(ScheminPrimitives.Filter); prebound_schemin.Add(ScheminPrimitives.Foldl); prebound_schemin.Add(ScheminPrimitives.Foldr); prebound_schemin.Add(ScheminPrimitives.Not); prebound_schemin.Add(ScheminPrimitives.Id); prebound_schemin.Add(ScheminPrimitives.Flip); prebound_schemin.Add(ScheminPrimitives.Fold); prebound_schemin.Add(ScheminPrimitives.Unfold); prebound_schemin.Add(ScheminPrimitives.Reverse); prebound_schemin.Add(ScheminPrimitives.Curry); prebound_schemin.Add(ScheminPrimitives.Compose); prebound_schemin.Add(ScheminPrimitives.Zero); prebound_schemin.Add(ScheminPrimitives.Positive); prebound_schemin.Add(ScheminPrimitives.Negative); prebound_schemin.Add(ScheminPrimitives.Odd); prebound_schemin.Add(ScheminPrimitives.Even); prebound_schemin.Add(ScheminPrimitives.CallWithCC); prebound_schemin.Add(ScheminPrimitives.Error); prebound_schemin.Add(ScheminPrimitives.Sum); prebound_schemin.Add(ScheminPrimitives.Product); prebound_schemin.Add(ScheminPrimitives.Max); prebound_schemin.Add(ScheminPrimitives.Min); prebound_schemin.Add(ScheminPrimitives.Caddr); prebound_schemin.Add(ScheminPrimitives.DefineMacro); Tokenize.Tokenizer t = new Tokenize.Tokenizer(); Schemin.Parse.Parser p = new Parse.Parser(); foreach (string primitive in prebound_schemin) { var tokens = t.Tokenize(primitive); var ast = p.Parse(tokens, false); Evaluate(ast); } }