Exemple #1
0
  def execute(self, scope, sexp):
    if types.is_atomic(sexp):
      return self.eval(scope, sexp)

    if types.is_nil(sexp):
      return sexp

    func = self.eval(scope, sexp.car)
    args = list(sexp.cdr)

    if types.is_primitive(func):
      return self.invoke(scope, func, args)

    if types.is_macro(func):
      return self.eval(scope, self.invoke(scope, func, args))

    if types.is_function(func):
      return self.invoke(scope, func, (self.eval(scope, arg) for arg in args))

    raise LispException("%s is not callable" % repr(func), sexp)
Exemple #2
0
 def atomic(self, scope, args):
   return types.py_to_type(types.is_atomic(args[0]))