Re: Functional programming?
- To: mathgroup at smc.vnet.net
- Subject: [mg92037] Re: Functional programming?
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Thu, 18 Sep 2008 06:12:15 -0400 (EDT)
- References: <200809130957.FAA03536@smc.vnet.net> <email@example.com> <200809162326.TAA24780@smc.vnet.net> <firstname.lastname@example.org>
Andrzej Kozlowski wrote: > On 17 Sep 2008, at 08:26, David Bailey wrote: > >> I feel there is another thing to say regarding FP. The fact that FP >> performs so well in Mathematica is, in my opinion, something of a >> fluke. >> The real reason is that because Mathematica is such a high level >> language, absolutely every step incurs considerable overhead, that is >> not present in languages such as Fortran or Java. Because FP >> provides a >> way to do a lot in one step, it reduces this overhead. > > I don't think it is a fluke, but simply a consequence of the fact that > Mathematica is or originated as a Computer Algebra System, and there > is no doubt that functional programming is the most efficient and > natural way to program in a CAS. I don't think there is any point even > arguing about this so I just note that the first (at least I think it > is the first) genuine CAS system did not even have its own programing > language but used LISP (the paradigm of all functional languages), > and one of Mathematica's main rivals, which uses a procedural > programming language (in my opinion a pretty awful one), had > functional constructs belatedly added to it. > > Andrzej Kozlowski > > I agree, what I meant was that FP's advantage over PP only exists in environments such as Mathematica. An FP extension to Java (say) would be no faster than an equivalent regular Java program - because both would be ultimately translated into the same machine instructions. BTW, modern Java is fully compiled just prior to execution. I think the mixture of FP and PP constructs in Mathematica is ideal. David Bailey http://www.dbaileyconsultancy.co.uk