Friday, February 8, 2008

Why plan when you can scheme?

Let me make a pitch for programming in scheme for math purposes.

Why is Scheme good for programming numerical methods and other math brick and brack?

Because it is so gloriously insane!

Scheme is a language without local variables, without control structures, without global constants, it uses reverse-Polish notation (those crazy Poles!) run usually by an interpreter... basically to the layman, let me say that it makes no sense.

But the advantage to Scheme is it fits very well with the idea of constructing logical algorithms and basing your math around that. Scheme strips algorithms down to their basic components, the procedures, and doesn't allow you to go any further than that. There's a ruthlessness to this restriction and enough power in this limited space that you end up being able to do a lot of math stuff simply and in a manner which illuminates the heart of the algorithm.

But it remains insane.

That said here's a good Scheme implementation:

Dr. Scheme

And here's a good guide to the language (note the implementation and this guide are not related, so some aspects of the guide may not work with this implementation):

The Scheme Programming Language by Kent Dybvig

Now I don't want this math blog to go all computer sciency, but it must be admitted that comp. sci. has some math overlap, especially when it comes to doing programming to make math easier. So look out in the future for some bursts of code for math-based functions, most likely in Scheme.

Keep on Scheming!

No comments: