I'm intrigued that Python has some functional constructions in the language.

Carl Banks pavlovevidence at gmail.com
Sun May 10 03:23:13 CEST 2009


On May 9, 10:57 am, namekuseijin <namekuseijin.nos... at gmail.com>
wrote:
> Carl Banks wrote:
> > On May 8, 7:19 pm, namekuseijin <namekusei... at gmail.com> wrote:
> >> On May 8, 10:13 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> >> In Haskell, Lisp and other functional programming languages, any extra
> >> syntax gets converted into the core lambda constructs.
>
> > So?  The user still uses that syntax, so how can you claim it doesn't
> > matter?
> >>  In Lisp
> >> languages, that syntax is merely user-defined macros, but in Haskell
> >> it's builtin the compiler for convenience.
>
> > I don't even know what you're saying here
>
> I'm saying syntax is nothing special.  They are user-defined, as
> functions.  And it all gets converted into functions.  Functions matter,
> syntax is irrelevant because you can do away with it.

Nope, sorry, you're ignoring half the problem here.  Syntax is only
irrelevant if you actually do do away with it.  As long as syntax is
there and people use it, then it matters, regardless of whether it all
reduces to function calls.

For a very benign example, consider the ways that Python and Haskell
write listcomps:

[ x for x in ss ]
[ x | x <- ss ]

One of these might be more readable than the other (I make no
implication which); however, readability has nothing to do with
whether the compiler internally reduces it to a function call or not.
Readibility counts, therefore syntax matters.

Now, maybe readability concerns don't matter to you personally, but it
does matter to the OP, who is trying to advocate functional
programming but is having difficulty because most purely functional
languages have hideous minimalist syntax that turns people off.

If that syntax could be made a little more readable and workable,
maybe people wouldn't turn up their noses at it on first sight.


> In Haskell, point free style of programming shows almost no signs of
> predefined syntax at all.  It's all function composition.
>
> In functional programming languages, predefined syntax is mostly
> irrelevant.  In Python and other imperative languages, it's absolutely
> necessary.  That's my point.

I think you are overstating this by a lot.


Carl Banks



More information about the Python-list mailing list