From f126db2e1d476d5f7457594bcb318a5cb5f0c528 Mon Sep 17 00:00:00 2001 From: mryouse Date: Wed, 22 Jun 2022 00:59:28 +0000 Subject: give builtin functions proper names --- neb/__init__.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'neb/__init__.py') 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__("", 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}" -- cgit v1.2.3