Hacker News new | past | comments | ask | show | jobs | submit login

I skimmed documentation of Python after people told me it was fundametally similar to Lisp. My conclusion is that that is not so. When you start Lisp, it does `read', `eval', and `print', all of which are missing in Python.

Lisp experts, what does this mean? As far as I can tell, Python has pretty good REPL facilities.




Python has a good REPL and it even has 'eval' and 'print', so RMS is wrong stating that all of them are missing in Python. But in principle he is right - Python does not have separate 'read' and 'eval' which is a manifestation of deeper differences.


The type of REPL he's referring to has very specific features. Read returns a parsed structure, eval evaluates a parsed structure and print writes a parsed structure. Python's REPL just deals with strings, I believe.


Yes, this is the case - Python's REPL (and eval) deals with strings and does not go through an explicit representation of the parsed code, mainly because there is no such representation in Python. There is an ast module that parses Python code but it is an add-on, not at the core of the implementation. That is what I meant by manifestation of deeper differences between Python and Lisp.


This makes me think. I know the ast module is an add-on and not at the core of the interpreter implementation. Has there been any attempts at building a interpreter that does the same(Read, eval,print, loop over data structures and not strings)?? It would be hard i guess, but interesting right?


All interpreters do it on some level, they just don't expose this functionality to user.

As soon as you want to expose it to user in a non cumbersome way, you realize that the thing that stands in your way is the syntax of your language -- converting from textual and structural representation back and forth does not look like the way to go. You need to get rid of one of them for it to make sense. But if you get rid of textual representation, you'll just get another Lisp.



I guess understanding the full implications of this is what Lisp Enlightenment is. http://xkcd.com/224/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: