From michael.bieniosek@gmail.com Mon Jan 2 19:10:24 2006 Date: Tue, 3 Jan 2006 03:10:20 +0000 From: Michael Bieniosek To: brendano@stanford.edu Subject: blisp patch Licensed under the same terms which govern blisp. - fix problem with PyEval which always caused if to receive a None test value - fix problem with map and switching variable order - added empty operation -- TODO: map doesn't need to be builtin, does it? --- builtins.py 98d65d0dd54f5afe87fe6d5ee76c5b213475d2bb +++ builtins.py 95cb8dce2e2253edb3b51c8e0416255b7a3935ee @@ -76,7 +76,7 @@ return EvalExpr(eval_this_copy, {}) def PyEval(cls, lispexpr): - cls.Call(cls(), [lispexpr]) + return cls.Call(cls(), [lispexpr]) PyEval = classmethod(PyEval) class Lambda(BuiltinMacro): @@ -85,12 +85,17 @@ params = lispargs[0]; assert not isinstance(params, str) evals_to = lispargs[1] return LispFunction(params, evals_to, "Anonymous Lambda Function") - + class Map(BuiltinFunction): def Call(self, lispargs): assert len(lispargs) == 2 - return map(lispargs[1].Call, [ [itm] for itm in lispargs[0] ]) + return map(lispargs[0].Call, [ [itm] for itm in lispargs[1] ]) +class Empty(BuiltinFunction): + def Call(self, lispargs): + assert len(lispargs) == 1 + return len(lispargs[0]) == 0 + class Defun(BuiltinMacro): needed_external_data = ("defined_fn_ns",) def __init__(self, fn_ns): =