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 14:29

python is the only scripting language that embraces functional programming

the guido is very interested in fp concepts and tries to incorporate them into the language whenever possible

Name: Anonymous 2011-11-26 14:54

It can read files, and it can eval and exec them, it also has print, also you forgot to terminate your [/o] block.

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.

Name: Anonymous 2011-11-26 16:07

Python uses the REPL in its interactive interpreter:
It reads your input, eval/exec it and print the result (if eval).

Name: Anonymous 2011-11-26 16:41

>>2
Lua supports functional programming, and anonymous functions.>>2
(not sure how to do specific language tags... so)

function foo(x)

     return function() return x+x end

end

Name: Anonymous 2011-11-26 17:28

specific language tags
lol
I don't think the language that Shiichan's code tags are made to highlight even exists.

Name: Anonymous 2011-11-26 17:37

specific language tags
lol
I don't think the language that Shiichan's code tags are made to highlight even exists.

Name: Anonymous 2011-11-26 18:14

>>6
um... this is javascript's territory, ``faggot''

Name: Anonymous 2011-11-26 19:08

Point is, Python does have `read', `eval', and `print'. Why would anyone say otherwise?

Name: Anonymous 2011-11-26 19:52

var PR_keywords = {};
/** initialize the keyword list for our target languages. */
(function () {
  var CPP_KEYWORDS = "abstract bool break case catch char class const " +
    "const_cast continue default delete deprecated dllexport dllimport do " +
    "double dynamic_cast else enum explicit extern false float for friend " +
    "goto if inline int long mutable naked namespace new noinline noreturn " +
    "nothrow novtable operator private property protected public register " +
    "reinterpret_cast return selectany short signed sizeof static " +
    "static_cast struct switch template this thread throw true try typedef " +
    "typeid typename union unsigned using declaration, directive uuid " +
    "virtual void volatile while typeof";
  var CSHARP_KEYWORDS = "as base by byte checked decimal delegate descending " +
    "event finally fixed foreach from group implicit in interface internal " +
    "into is lock null object out override orderby params readonly ref sbyte " +
    "sealed stackalloc string select uint ulong unchecked unsafe ushort var";
  var JAVA_KEYWORDS = "package synchronized boolean implements import throws " +
    "instanceof transient extends final strictfp native super";
  var JSCRIPT_KEYWORDS = "debugger export function with NaN Infinity";
  var PERL_KEYWORDS = "require sub unless until use elsif BEGIN END";
  var PYTHON_KEYWORDS = "and assert def del elif except exec global lambda " +
    "not or pass print raise yield False True None";
  var RUBY_KEYWORDS = "then end begin rescue ensure module when undef next " +
    "redo retry alias defined";
  var SH_KEYWORDS = "done fi";
  var LISP_KEYWORDS = "defun";

Name: Anonymous 2011-11-26 19:59

>>10
Because idle is garbage.

Name: Anonymous 2011-11-26 20:54

>>1
care to elaborate on the above?
It's called "smug lisp weenie", a person whose ignorance is so deep that it definitely must signify serious mental retardation, and which also powers a formidable aura of smugness (by means of Dunning-Kruger effect and similar stuff).

Secondary attributes of SLWs include the absolute inability to see through irrelevant, superficial details, and perpetual fascination with trivial stuff that intellectually normative people learn, familiarize with, and stop preaching about on every corner in a matter of weeks or days. For example, >>4 is another SLW.

Name: Anonymous 2011-11-26 21:43

>>13
There are no smug lisp weenies, only butthurt C++ programmers.

Name: Anonymous 2011-11-26 22:47

>>10
Python's ability to extend the reader is less powerful, in that it is non-existent.

Name: Anonymous 2011-11-27 1:23

>>15
Homework: implement scheme in python by transforming the s-expressions in a string into a string of python code, which is then evald. You do not need to implement syntax-rules but you must accept unbounded tail calls.

Name: Anonymous 2011-11-27 1:59

>>16
Enjoy your FIOC.

Name: Anonymous 2011-11-27 2:43

>>17
Enjoy my anus.

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