Monday, January 18, 2010

Hello, Functional World! -- A gap in the market

Reading my newly arrived copy of Real World Functional Programming, I couldn't help but feel that its very gentle introduction to the style so nearly makes it suited to being a pure introduction to programming via the functional style, if only it were not for the compare/contrast with an assumed fluency in C#; in the same way that Scala texts do with Java.

If functional programming is the up and coming thing as it is seeming to be, wouldn't it be nice to have a book at the level of, say, Hello World! or Python Programming for the Absolute Beginner? Something which really does start teaching programming in a functional way from the ground up, and, moreover, try to make it fun for youngsters by bringing in some eye-candy in the form of games. That rules out SICP, or even the Little Schemer, which is very abstruse for all its wry humour.

So what has a games platform? With F#, we can use either the old managed DirectX, or XNA, but those are very tied to Windows; Scala or Clojure could tie into the MIDP with phone emulators; at a pinch, you can write games in wxWidgets and might be able to do something with wxErlang. Masochists have even tried writing GUI games in Haskell. So it's not as if there is a dearth of possible languages to work with, even if they may not approach having something like PyGame to do a lot of the heavy lifting.

Possibly the main limit is in tooling -- no integrated chroma-coded REPL like IDLE offers for Python. There are chroma-coded editors with some shell integration -- Scite has Erlang mode, Scala comes with in Scala\misc\scala-tool-support\scite (though you may need to edit the command lines in it to have an explicit .bat on the scripts -- but pretty much every instruction I see for anything on MacOS X starts with "Download Xcode ... its little over 1 GB." -- well, I exaggerate; not all the instructions mention the sheer size of the bundle. Even instructions for setting environment variables reach for Xcode, which puts a big burden on top of setting up Scala-on-NetBeans, which would otherwise be comparatively lightweight.

But wouldn't it be great to start beginners off without mutability and iteration?

Post a Comment