the programers in the industry, including bigwigs such as Guido or that
Larry Wall fuckhead, really don't know shit about computer languages.
Sometimes i get pissed by Stephen Wolfram's megalomaniac cries, but in
many ways, i think his statements about the fucking moronicities of the
academicians and otherwise dignitaries are justified.
here i will try to illuminate some miscellaneous things regarding the
lambda in Python issue.
as i have hinted
(
http://xahlee.org/perl-python/list_comprehension.html ), the
so-called List Comprehension is just a irregular syntax to facilitate
generating lists. The name is a terrible jargon, and the means is also
quite fucked up. The proper name should be something like
ListGenerator, and the proper means should be the plain function.
For instance, Python's range() is such a list generator, only that it
is limited in scope.
For a example of a powerful list generator, see Mathematica's Table
function:
http://documents.wolfram.com/mathematica/functions/Table
i'm running a project that will code Table in Perl and Python and Java.
You can read about the spec and source code here:
http://xahlee.org/tree/Table.html
(note: the Python version there isn't complete)
Note Table's power in generating not just flat lists, but trees. And if
one really want flat lists, there's the Flatten function that flats any
nested lists. (Python should have this too)
Python's reduce() is Mathematica's Fold. See
http://documents.wolfram.com/mathematica/functions/Fold
Besides Fold, there's FoldList, FixedPoint, FixedPointList, Nest,
NestList and others. In Python's terms, FoldList is like reduce()
except it returns a list of each steps. FixedPoint recursively applies
a function to itself until the result no longer changes (or when a
optional function returns true) Nest is similar except it limits the
iteration by a number. The NestList and FixedPointList are similar
except that they return a list, containing all the steps.
All these can be written as a loop, but they make the code condensed
and meaning clear. More so, they are important when programing in a
functional style. In functional programing, you don't litter lots of
variables or temporary functions or intermediate loops here or there on
every other line. The code is usually tight and inline. When sequencing
a series of functions, you can't stop in the middle and do some loop or
auxiliary calculation. All these are made inline into a function. (that
is: constructed as lambda) A block of code usually corresponds to a
unit of the algorithm used, as opposed to the particular unit of the
implementation of the algorithm. You don't read the minute details of
the code. You read the algorithmic unit's comments, or just the input
and output of a code block.
Also, these inline loop constructs are not just for computing numbers
as Guido likes to ignorantly think. They are specialized forms of
generic loop constructs. Their first argument is a function, and second
argument is a list. Their generality lies with the fact that their
first argument is a function. If a language does not provide a
convenient way to represent the concept of a function, than these
functional loop constructs will suffer in usability.
The Python morons, did not provide a convenient way to represent a
function. (they tried, with their limited implementation of lambda and
shun it like a plaque)
The way Guido puts it gives us a nice glimpse of their retarded
mentality: “Also, once map(), filter() and reduce() are gone, there
aren't a whole lot of places where you really need to write very short
local functions;â€
As we can see here, in Pythoner's mind, lambda is for “very short
local functionsâ€.
Python's limited lambda coupled with their lambda attitude problem
among imperative morons, therefore functional programing suffers in
Python, and consequently one becomes so stupid as to come up with a
bunch of feelings about lambda, map, reduce, filter.
For Python's map(), look at Mathematica's Map on how it might be
extended.
http://documents.wolfram.com/mathematica/functions/Map
Note the ability to map to not just flat lists but trees (nested
lists). Note the power of expressing the concept of levels of a tree.
For Python's filter(), check out the equivalent in Mathematica's
Select:
http://documents.wolfram.com/mathematica/functions/Select
Note how it provides a third option for picking just the first n items.
Also note, that Select is just a way to pick elements in a list.
Mathematica provides a set to do these: Part, Take, Drop, Select,
Cases. All uniformly uses the function syntax and all operate
semantically by returning a new list. In Python and other imperative
clown's language, usually they provide a limited varieties to do such a
task, and also inconsistent like piled on. (e.g. alist[5:9], filter(),
alist.remove(...), del alist[...]). Some modify the list in-place, some
returns a new list.
-----------------
one is quite sorry to read a big shot contemplating on petty issues
with a ambitious name Python THREE THOUSAND.
For the grand Python THREE THOUSAND, what about supporting non-trivial
things such as built-in transparent fractions? What about a smart
exact-arithmetics once for all? What about supporting pattern matching?
(not textual pattern matching (e.g. regex) as Imperative Morons wont to
understand, but patterns of list structures and data types.)
the features of Mathematica mentioned above existed over a decade ago.
But today, OpenSourcing bigwigs can contemplate and dither nothing but
which lipstick to use.
A good number of the industrial dignitaries are just fucking liers. And
today we have the fucking Java and fucking Perl and their bosses
trumpeting their fucking state-of-the-art-ness. Go **** your wifes.
(disclaimer: all mentions of any real person are just opinion.)
-----
See also:
http://xahlee.org/perl-python/python_3000.html
Xah
(e-mail address removed)
∑
http://xahlee.org/