diff options
| author | mryouse | 2022-06-22 04:33:37 +0000 | 
|---|---|---|
| committer | mryouse | 2022-06-22 04:33:37 +0000 | 
| commit | 4fb8e57aa6ea23a98d24e2193065dff49f2f0b75 (patch) | |
| tree | 2451f016f59b9e4398463120cb05dced0589be1d | |
| parent | 810d01108110901a290aa4d4a9cdf96187430d0d (diff) | |
bugfix: we need to return an Expr from apply, and List is no longer evaluated
| -rw-r--r-- | neb/__init__.py | 2 | ||||
| -rw-r--r-- | neb/std/functools.py | 4 | 
2 files changed, 3 insertions, 3 deletions
| diff --git a/neb/__init__.py b/neb/__init__.py index 16d5e44..7e3075b 100644 --- a/neb/__init__.py +++ b/neb/__init__.py @@ -11,7 +11,7 @@ def interpret(exprs, env, ns=None):      return ret  def evaluate(expr, env, ns=None): -    if isinstance(expr, Literal) or isinstance(expr, Function) or isinstance(expr, TypeWrap): +    if isinstance(expr, Literal) or isinstance(expr, Function) or isinstance(expr, TypeWrap) or isinstance(expr, List):          return expr      elif isinstance(expr, Symbol) or isinstance(expr, Type):          if env.contains(expr.name): diff --git a/neb/std/functools.py b/neb/std/functools.py index 83475b9..facc97d 100644 --- a/neb/std/functools.py +++ b/neb/std/functools.py @@ -39,8 +39,8 @@ def interpretApply(symbol, args, env, ns):      func = args[0]      if not isinstance(func, Symbol):          raise InterpretPanic(symbol, "requires a symbol as its first argument", func) -    new_lst = List([func] + args[1].args) -    return evaluate(new_lst, env, ns) +    new_expr = Expr([func] + args[1].args) +    return evaluate(new_expr, env, ns)  FUNCTOOLS.register("apply", Builtin("apply", interpretApply, [Arg("func", TypeEnum.ANY, lazy=True), Arg("list", TypeEnum.LIST)])) | 
