Why full closure support makes Perl great for science

Part of the reason I love Perl is that it has full closures. It makes it really easy for my scientist brain to think of code references as equations. This is why I try to make my scientific software think this way too; PerlGSL is built on this concept. Its especially fun when this allows me to nest functionality to get even more complex behavior.

In this following example I find the Gaussian width needed so that the integral over it on a certain range has a particular value. Yes this is an easier example, but if the function f were more complex, this code would be no worse.

Hopefully this shows some of that power, and some of the reason I am working on PerlGSL.

I will be going into more detail on similar concepts at one of my talks at YAPC::NA later this month. See some of you there?

Leave a comment

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.