
Guido on Functional - apgwoz
http://fold.sigusr2.net/2010/03/guido-on-functional.html
======
mainland
As much as I like Python, Guido has repeatedly demonstrated a pretty
fundamental lack of understanding when it comes to functional programming
concepts (I'm thinking in particular of past HN discussions regarding his
confusion about the difference between tail calls and tail recursion). While
it's entirely appropriate to take the stance that Python should not become
"more functional" (whatever that means), it's not appropriate to do so without
a clear understanding of what you're talking about.

For the record, here's a link to the Haskell Prelude version of reduce, aka,
foldr. Looks like "a few lines" to me...

[http://haskell.org/ghc/docs/latest/html/libraries/base-4.2.0...](http://haskell.org/ghc/docs/latest/html/libraries/base-4.2.0.0/src/GHC-
Base.html#foldr)

~~~
Xichekolas
In looking at that, I was surprised to see that the foldr/build deforestation
technique is still in use. That was part of my advisor's PhD work from the mid
90s.

------
JoelMcCracken
If I had to guess, he thinks this way because he isn't yet used to thinking
about space-free tail calls. In that sense, he's correct -- you really
couldn't create a usable reduce if the function grew linearly in the size of
the list. However, this is not a restriction that we actually face.

It amazes me how some programming language authors seem to be clueless about
really major areas of our field.

If I ever were to design a language, it would only be after studying all of
the various interesting programming languages. How else can you be certain
that you aren't doing something that hasn't been done before?

~~~
alec
"It amazes me how some programming language authors seem to be clueless about
really major areas of our field."

I saw Larry Wall speak within the last year or so about Perl 6. His
presentation on the stuff inherited from Perl 5 was solid, but when he started
talking about the other things that were more functional and/or "like
Haskell", there was a marked change in his confidence and depth of
description. I saw him go to dinner with some people organizing the talk and
when asked about what other languages he had studied besides Perl, I recall
his answer was something along the lines of "well, lots of Perl is written in
C." I came away with the impression that he didn't study other languages in
order to improve Perl, and the more functional stuff in Perl 6 was coming from
somewhere else.

~~~
jrockway
I've talked with Larry about Pugs. He knows Haskell.

------
jrockway
Guido is exactly right. reduce is one line of code, not "a few" lines of code.

~~~
mbrubeck
The Haskell 98 Report takes two lines:

    
    
        foldr f z []     =  z
        foldr f z (x:xs) =  f x (foldr f z xs)
    

Clojure does it like this (note the overloading - this is both "foldl" and
"foldl1" in Haskell terms):
[http://github.com/richhickey/clojure/blob/49a7d6b8e14050a45d...](http://github.com/richhickey/clojure/blob/49a7d6b8e14050a45df5332e768ba6647752215d/src/clj/clojure/core.clj#L691)

~~~
jdeseno
Couldn't we do this?

r' f (x:xs) | xs == [] = (f x):[] | otherwise = (f x):(r' f xs)

or:

[(f a) | a <\- myList]

\- another edit -

r' f (x:xs) | xs == [] = x | otherwise = f x (r' f xs)

~~~
mbrubeck
That's map, not reduce.

------
va_coder
Guido works at Google. I wonder if Google is looking at functional languages
like Clojure.

~~~
mahmud
Google is not the homogeneous or coherent; IMO, they've transcended languages
by standardizing on communication protocols, which are far more important.

~~~
Luyt
A bit like Facebook does with Thrift?

~~~
jganetsk
Hah! Thrift is a knockoff of an older Google technology called Protocol
Buffers, which is also open source.

Take a look for yourself.

