JustUI/juic/builtins.py
Lephenixnoir 24f3e14061
juic: WIP
2024-08-28 08:52:07 +02:00

20 lines
559 B
Python

from juic.datatypes import *
from juic.eval import *
def juiPrint(*args):
print("[print]", *args)
def juiLen(x):
if type(x) not in [str, list]:
raise JuiTypeError("len")
return len(x)
builtinClosure = Closure(parent=None, scope=MutableScopeData(defs={
"print": (0, BuiltinFunction(juiPrint)),
"len": (0, BuiltinFunction(juiLen)),
# TODO: Remove the built-in record type "record" used for testing
"record": (0, RecordType.makePlainRecordType()),
"subrecord": (0, RecordType.makePlainRecordType()),
}, timestamp=1))