There are two styles of expression in higher level languages
(including Python and Clojure). Functional programming (map, filter,
reduce, fold) on one side and set (and list) comprehensions on the
other. This is somewhat a matter of culture, not capability. Although
slightly less convenient, functional programming is certainly possible
in Python, and likewise Clojure includes comprehensions. Python
programmers are more likely to reach for comprehensions and generator
expressions (lazy comprehensions) and Clojure programmers are more
likely to reach for functional operators and lazy sequences.

Having used both comprehensions and functional languages is that they
are about equally expressive, equally powerful, and generally used for
the same purposes. I would much rather programming in a language that
has a good tools for functional programming or comprehensions than a
language that does not have one or the other. Other than that I have
no strong preference.

Some comprehension (style) languages: SETL (see 
http://en.wikipedia.org/wiki/SETL.
SETL is a long-lost, but very interesting family of very high level
languages based on set theory), Haskell, Python. Its interesting that
Python, which started out inspired by SETL, only adopted
comprehensions much later via Haskell. Python has become very SETL-
like over time.

Some functional (style) languages: Lisp, Scheme, ML, OCaml, Haskell,
Smalltalk, Ruby, Scala, and of course Clojure. Smalltalk began the
process of integrating the functional and object-oriented traditions
by basing all of its control constructs on "blocks" which are just
anonymous functions. Ruby's use of blocks are almost identical to
those in Smalltalk.

I much prefer Python's more set-theory like syntax for comprehensions
to Scala and Clojure's versions, but as I mentioned, comprehensions
have a smaller role in languages that emphasize functional
programming. I am just as happy using using map, filter, reduce, and
iterate. I suspect, since there are many more languages that emphasize
the functional style that the style will continue to grow in
popularity. But Python also has a fully valid and equally expressive
way of saying some of the same things. I do think set-theory style
comprehensions (as in Python) are often are more readable than
equivalent functional expressions. Its worth paying attention.

Clojure and Scala have other strong benefits, so I continue to do much
of my (exploratory) programming in those.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to