Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

`read', `eval', and `print'

Name: Anonymous 2011-11-26 14:12

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.[o]
Some EXPERT PROGRAMMERS care to elaborate on the above? The last part (read/eval/print), not the one about the similarity.

Name: Anonymous 2011-11-26 16:03

The Lisp reader reads in Lisp objects directly from the textual representation, so reading in "(lambda (x) (+ x x))" from a file returns a list with lambda as the car and ((x) (+ x x)) as the cudder, whereas reading in "lambda x: x + x" from a file in Python just gives you the string "lambda x: x + x". The Lisp printer can than print that list out and read it back in again as the same object. Because code is represented as data, you can call eval on that list and it will evaluate to a function object. In Python, you must read in a string that contains Python code, then parse and execute it before you get the object that it evaluates to.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List