diff options
| author | mryouse | 2022-06-30 03:40:39 +0000 |
|---|---|---|
| committer | mryouse | 2022-06-30 03:40:39 +0000 |
| commit | bf8900200c25d383c883501446a8048ad8966d94 (patch) | |
| tree | c9c5fbd4563b2edc066339f0933d9b225bb5bdd6 /neb/__init__.py | |
| parent | 5274edb5484f75266304d21840f8e854f2a1d3c5 (diff) | |
initial commit of multi-type support (only list of strings for now)
Diffstat (limited to 'neb/__init__.py')
| -rw-r--r-- | neb/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/neb/__init__.py b/neb/__init__.py index 9b3c1e9..ab0f836 100644 --- a/neb/__init__.py +++ b/neb/__init__.py @@ -13,7 +13,7 @@ def interpret(exprs, env, ns=None): def evaluate(expr, env, ns=None): 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): + elif isinstance(expr, Symbol) or isinstance(expr, Type) or isinstance(expr, MultiType): if env.contains(expr.name): return evaluate(env.get(expr.name), env, ns) elif ns is not None and env.contains(f"{ns}/{expr.name}"): @@ -144,7 +144,7 @@ class UserFunction(Function): newparams.append(param) args.append(Arg(param.name, TypeEnum.ANY)) prev_type = False - elif isinstance(param, Type) and not prev_type and not first: + elif (isinstance(param, Type) or isinstance(param, MultiType)) and not prev_type and not first: if many is None: args[-1].type_ = param.name else: |
