The rise of Python in computational science
walkingrandomly.com
walkingrandomly.com
nope, and why would we? For many applications, including the majority of scientific research, FP is a non-starter. You need a simple, robust, procedural language that thinks the way most of our brains are wired. There is no reason or payoff to wrapping your mind around an arcane style of programming when the software project is not going to need the benefits of that style of development.
I think the language is just part of it. I would go as far as saying that from a purely "technical" POV, lisp and ML (e.g. OCAML) are superior languages to python in almost every way. Nevertheless, I think those are, at least today, not as good choices as python for scientific research, for at least two reasons.
First, I strongly believe scientific work in general needs to be more open, both publication-wise and implementation-wise. I see programming languages as a communication tool as much as an implementation tool for science, and I think python fills this very well, because it is very readable to the casual programmer. LISP is too foreign for this audience. P. Norvig mentioned about LISP relative failure for non CS scientists this at his talk for scipy09 (http://www.archive.org/details/scipy09_day1_03-Peter_Norvig) - and I think you can count him as a LISP fan. To quote his talk, at some point, "you have to stop fighting reality".
Secondly, there is something about the LISPs, haskell and OCAML communities which do not pave well compared to python. Those are very CS-savies, really oriented toward programming - which is fine. Different goals, different tools and all that.
Also, do not forget that in science, projects generally last much longer than in most other areas. That's one of the reason why Fortran is still so pervasive, after all. It is also maintained by different people (grad students, etc...), involving several generations in some cases. Having a relatively mainstream language is a requirements - python is already too weird in many cases...
Concerning parallelization: even if you assertion were true, that's a concern only for a tiny proportion of what people do. Speed really does not matter most of the time (but it is true that when it does, it often does it in a significant way - high energy physics, climate modellization, etc...). I would be cautious about FP being better for parallelization for scientific work, though: a lot of tasks can be solved using MPI, etc... and correct me if I am wrong, but I don't believe FP brings a lot of advantages there.
Recently, a perspective from W. Stein, who started the SAGE project, was mentioned on LtU, and the article provides more insights, coming from a quite different background: http://lambda-the-ultimate.org/node/3712
Given that, and the fact that languages such as Lisp, Haskell and OCaml are more aimed at the functional paradigm, wouldn't you agree that there is possibly a general shift going on in scientific programming in general, from Fortran/C(++) imperative style, via python, towards finally any of Haskell, Lisp and/or OCaml?
I don't really agree with your implication that the (at first) obscure way of doing things functionally makes the work less open, and that this makes it less desirable. If everyone worked in exactly the same way, communication would be easier, but there would never be any disruptive change. I think letting everyone figure out for themselves what language works best for his/her appliciation has more merits than trying to enforce a standard, be it python + numpy & scipy, or anything else. If there turns out to be one clear winner, people will gravitate to that automatically, but you shouldn't argue for harmonization for its own sake.
Not only are there few, their numbers are growing much more slowly than traditional C/Fortan/MPI environments. The "massive" in massively parallel is getting more and more massive every year. Running computations at full speed at these scales, 100K+ cores in multiple levels of hierarchy (same die, same board, same blade, same switch, etc) is a hugely mundane architectural problem. Not only is there no architecture besides MPI which has nearly as much effort invested in this problem, none are currently making the investment, so none have a chance to catch up within the next decade. The only way you will see FP doing massive parallelism at speeds even close to current best is if they wrap the C MPI interface, and I have yet to see any functional message-passing APIs which aren't tarted-up imperative environments. (If anyone knows any please share.) At it's core, message passing programming involves managing data, deciding where it resides and where it needs to go, which is kind of antithetical to FP.
You mention MapReduce, which I think is more of a data-center thing subtly but fundamentally different from HPC, involving less computation and more I/O. FP has a good shot there (cf. Erlang) but not much chance at cracking the HPC market.
True, I would not be surprised if it evolved that way, but according to my (modest) knowlegde, it is possible for imperative routines to have a purely functional interface. The extreme case of course is the fact that any functional high-level code needs to be translated to assembly code to run at all, but I don't see why that boundary can't be on a higher level; As long as the developer programs functionally (and derives the benefits from that), does it matter that his code is being translated first into imperative MPI-ified C, and then assembly?
This is all provided, of course, that you can actually leverage the parallelism-related benefits of FP this way, which I guess is not known as of yet. You mentioned "functional message-passing APIs which [are] tarted-up imperative environments", care to give an example? I'm intrigued...
As for MapReduce, of course it's different from what the average HPC machine is used for, but being an embarrassingly parallel problem, it's one of the first problems where the FP approach has been shown to work. In other (eg typical HPC) applications, there's lots of work ahead in rethinking the algorithms so they can be expressed functionally, before you can even begin contemplating how to use the hardware.
A. an easy way to call into Haskell or some other fp from python.
B. the ability to embedd the above so that I can have equations in a nice mathy looking form but the rest in python.
C. all of the above w/ R too.
I mean, c'mon. Who was not confused by Haskells IO?
And now, compare this with "foo = input()", or "bar = scanf("%d");". Bam. All the benefit of nice functional notation for the algorithms superseded by the hassle of getting data from the outside into the program (or, the very small hassle (seen relatively) to do so in imperative languages.
In the real world people care about obtaining results as fast and painlessly as possible. The language is just a tool, not a goal.
* Easy to learn (including a REPL),
* Multi-paradigm programming (doesn't shove a One True Way To Program(TM) down your throat), and, most important of all,
* Solid, battle-tested libraries for the domain (SciPy/NumPy/Sage/etc.) and an easy-to-use interface to/from C.
But to be fair, none of those implementations are usable for most scientific work, as numpy is only available on CPython, at least today.
It's a sharp contrast to when people have to decide which Lisp or Scheme to learn with, but don't have enough experience to choose. (Some probably decide on Python instead.)
Lisp goes significantly farther towards shoving FP down your throat than Python does any individual paradigm.
Lisp does not (to the best of my knowledge) have anything to match scipy/numpy.
Now, this doesn't mean that I wouldn't prefer if the scientific community were dominated by FP instead of Fortran and Python, but I think it's very easy for people like us to go and say "FP is easy" without realizing that for most people it's really not.
This is simply not the case. It has the best OO system in existence. It has the loop macro (mini language). In actual practice I think lispers tend to not program so functionally because they're instinctively afraid of consing.
However, looking at the examples it seems to be used imperatively anyway (it even lets you include C code inline): http://lush.sourceforge.net/screenshots.html
I'm the heaviest user of python and this is because it allows me to get things done quickly (I need to concentrate on the science and not the joy of programming during office hours). Python is a great scripting language and that's how I use it. I find that I have to think too much when using Lisp on simple programming tasks and I'm being challenged enough by the maths or logic of the problem I'm working on.
That said, all genetic programming is done is Lisp because no other language comes close. The numerical performance of Lisp is also very good -- I'd say about 1/2 that of C++ when using SBCL. This speed is fast enough and impressive for a dynamically typed language.
You don't know the "fight" that is to use Lisp in this field/community. The few times I use Lisp is for solo work, because every time I do collaborative work people simply refuse to even considered it. The myths against Lisp are pretty strong and people just refuse to change their minds. Which I think it's kind of ironic since in a science/research environment, people should be more open-minded. Oh well...