diff options
| author | mryouse | 2022-06-22 00:59:28 +0000 |
|---|---|---|
| committer | mryouse | 2022-06-22 00:59:28 +0000 |
| commit | f126db2e1d476d5f7457594bcb318a5cb5f0c528 (patch) | |
| tree | e23fc55a7d864cc47685c6199ce1775c265f1a85 /neb/__init__.py | |
| parent | f2c9f51359f7f2c7a1b968bc72ca911b7bb2b2d0 (diff) | |
give builtin functions proper names
Diffstat (limited to 'neb/__init__.py')
| -rw-r--r-- | neb/__init__.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/neb/__init__.py b/neb/__init__.py index 583bef8..a492df8 100644 --- a/neb/__init__.py +++ b/neb/__init__.py @@ -49,12 +49,8 @@ class Function: if name is None: name = self.name out = [f"({name}"] - if self.args is not None: - for arg in self.args: - out.append(f"{arg}") - if self.many is not None: - out.append(f"{self.many}") - return " ".join(out) + ")" + out.append(string_args(self.args, self.many)) + return " ".join(out).strip() + ")" def arity_check(self, symbol, params): min_arity = len([a for a in self.args if not a.optional]) @@ -95,8 +91,8 @@ class Function: class Builtin(Function): - def __init__(self, callable_, args=None, many=None): - super().__init__("<builtin>", None, callable_, args, many) + def __init__(self, name, callable_, args=None, many=None): + super().__init__(name, None, callable_, args, many) def __str__(self): return f"builtin function {self.name}" |
