5 ms·
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 `
by bfrs 15y ago
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.
- tedunangst 15y agohttp://news.ycombinator.com/item?id=3810009 http://news.ycombinator.com/item?id=3810009
- bfrs 15y agoI guess understanding the full implications of this is what Lisp Enlightenment is. http://xkcd.com/224/ http://xkcd.com/224/
- praptak 15y agoPython 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.
- turkeysandwich 15y agoThe 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.
- praptak 15y agoYes, 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.
- aangjie 15y agoThis 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?
- xyzzyz 15y agoAll 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.