V
Ville Vainio
Apparently there is some kind of toy Lisp interpreter written in Python:
http://www.biostat.wisc.edu/~annis/creations/PyLisp/pylisp.html
However, how about extending the idea? I.e., making all the Python
functions callable from Lisp, and having all the objects in Lisp
actually be Python objects (using some classes like cons cells etc.):
-----------------------------
lst = readlisp("""(defun sum (x y) (+ x y))""")
# lst == <cons cell at 0x123>
ns = mk_lisp_namespace() # this has lambda, defun, defmacro & friends
eval (lst,ns)
# ns["sum"] == <cons cell>
def sum2(x,y):
return x+y
ns["sum2"] = sum2
s = evallist("(sum2 2 3)",ns)
# s == 5
http://www.biostat.wisc.edu/~annis/creations/PyLisp/pylisp.html
However, how about extending the idea? I.e., making all the Python
functions callable from Lisp, and having all the objects in Lisp
actually be Python objects (using some classes like cons cells etc.):
-----------------------------
lst = readlisp("""(defun sum (x y) (+ x y))""")
# lst == <cons cell at 0x123>
ns = mk_lisp_namespace() # this has lambda, defun, defmacro & friends
eval (lst,ns)
# ns["sum"] == <cons cell>
def sum2(x,y):
return x+y
ns["sum2"] = sum2
s = evallist("(sum2 2 3)",ns)
# s == 5