Lisp in Python as a library (not crossposted)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ville Vainio

    Lisp in Python as a library (not crossposted)

    Apparently there is some kind of toy Lisp interpreter written in Python:



    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("""(de fun sum (x y) (+ x y))""")

    # lst == <cons cell at 0x123>

    ns = mk_lisp_namespa ce() # 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

    ---------------------------------

    Sounds like a nice way to bring us all the macro power our Lisp
    friends glorify so much, and a way to end all the inter-newsgroup
    flamewars once and for all :-).

    --
    Ville Vainio http://www.students.tut.fi/~vainio24
  • Alan Gauld

    #2
    Re: Lisp in Python as a library (not crossposted)

    On 21 Oct 2003 09:39:04 +0300, Ville Vainio
    <ville.spammeha rdvainio@spamtu t.fi> wrote:[color=blue]
    > Apparently there is some kind of toy Lisp interpreter written in Python:
    >
    > http://www.biostat.wisc.edu/~annis/c...sp/pylisp.html[/color]

    Danny Yoo did a basic Scheme or Lisp intrpreter in Python a few
    years ago - it may be on the Useless Python website...???


    Are you listening Danny?

    Alan G.

    Author of the Learn to Program website

    Comment

    • Robin Becker

      #3
      Re: Lisp in Python as a library (not crossposted)

      In article <3f95abc6.85968 2748@news.bluey onder.co.uk>, Alan Gauld
      <alan.gauld@bti nternet.com> writes[color=blue]
      >On 21 Oct 2003 09:39:04 +0300, Ville Vainio
      ><ville.spammeh ardvainio@spamt ut.fi> wrote:[color=green]
      >> Apparently there is some kind of toy Lisp interpreter written in Python:
      >>
      >> http://www.biostat.wisc.edu/~annis/c...sp/pylisp.html[/color]
      >
      >Danny Yoo did a basic Scheme or Lisp intrpreter in Python a few
      >years ago - it may be on the Useless Python website...???
      >
      >
      >Are you listening Danny?
      >
      >Alan G.
      >
      >Author of the Learn to Program website
      >http://www.freenetpages.co.uk/hp/alan.gauld[/color]
      I wish all the lisp versus python wars would go away, but if they really
      want to do 'my language is bigger than your language' then cross
      language translation is the way to go. Then they can argue about code
      size efficiency etc in some reasonable way. Assuming both languages are
      Turing complete probably eliminates most of the arguments anyway.
      --
      Robin Becker

      Comment

      • Damien Wyart

        #4
        Re: Lisp in Python as a library (not crossposted)

        * alan.gauld@btin ternet.com (Alan Gauld) in comp.lang.pytho n:[color=blue]
        > Danny Yoo did a basic Scheme or Lisp intrpreter in Python a few years
        > ago - it may be on the Useless Python website...???[/color]

        It can be found here :

        <http://www-hkn.eecs.berkel ey.edu/~dyoo/python/pyscheme/index.html>

        --
        DW

        Comment

        Working...