Hacker News new | ask | show | jobs
by okaleniuk 4 days ago
Classics!

There is a different take on Lisp in Python - fakelisp. It's literally Lisp in Python, not an interpreter, but a syntax sugar library that allows embedding Lisp snippets into valid Python.

https://codeberg.org/okaleniuk/fakelisp

    from fakelisp import *

    # And now you can start mixing Python and LISP
    X = (BEGIN
        (SET (F) (LAMBDA (X)
            (IF (EQ (X) (1))
                (1)
                (MUL (X) (F (SUB (X) (1)))))))

        (LIST (F (4)) (42)))

    # Back to Python any time
    print "x: ", str(X)