switch miracle from module keying to eval

master
cynic 3 years ago
parent fba88fd65b
commit 790ba06b42
  1. 2
      lib.py
  2. 4
      lib/kokoro.klambda
  3. 2
      lib/lists.klambda

@ -67,7 +67,7 @@ def execute(program):
elif ctx[0][1] == "id": elif ctx[0][1] == "id":
return subs[1] if len(subs[1:]) == 1 else subs[1:] return subs[1] if len(subs[1:]) == 1 else subs[1:]
elif ctx[0] == _ident("miracle"): elif ctx[0] == _ident("miracle"):
return _box(getattr(sys.modules[_destr(subs[1])], _destr(subs[2]))(*[i[1] for i in _fixarr(subs[3])])) return _box(eval(_destr(subs[1]))[_destr(subs[2])](*[i[1] for i in _fixarr(subs[3])]))
elif ctx[0] == _ident("def"): elif ctx[0] == _ident("def"):
idspace[subs[1]] = subs[2] idspace[subs[1]] = subs[2]
return idspace[subs[1]] return idspace[subs[1]]

@ -1,9 +1,9 @@
(defun spit (defun spit
(miracle (miracle
"builtins" "print" (id $1))) "__builtins__" "print" (id $1)))
(defun input (defun input
(miracle (miracle
"builtins" "input" (""))) "__builtins__" "input" ("")))
(defun thesis (defun thesis
(spit (spit
("this language belongs to makise kurisu. there are many like it, but this one is hers."))) ("this language belongs to makise kurisu. there are many like it, but this one is hers.")))

@ -1,3 +1,3 @@
(defun length (defun length
(miracle (miracle
"builtins" "len" ((id $1)))) "__builtins__" "len" ((id $1))))
Loading…
Cancel
Save