[r-t] Scala, and its application to ringing problems
Mark Davies
mark at snowtiger.net
Wed Jul 4 06:51:11 UTC 2012
In the investigation of Philip's Helixoid-based extents, I've been using
a language called Scala. It is a relatively new language, although now
pretty mature, which combines object-oriented programming in the style
of Java with the functional approach championed by languages such as
Lisp, Haskell, Clojure and Erlang. It might seem madness that these two
very different paradigms can be made to work together, but Scala not
only succeeds in this challenge, but makes it look and feel like the
most natural thing in the world.
I have been dabbling with Scala for about 18 months, but this is the
first time I have used it for a serious exercise in composition. It has
proved extremely well suited to the rapid prototyping and good execution
speeds required for composing tasks. In fact, I'm so taken with it that
I thought it worth disseminating my experiences to the ringing/composing
community.
The website for the Scala language is here:
<http://www.scala-lang.org/>
If you are interested in it, or indeed interested in programming in
general, you can do no better than read the Scala book, which as well as
teaching you the language happens in my view to be the best book on
programming ever written. It is an absolutely cracking read, and there
is not much which you need to know about programming which it does not
contain, nor which it does not elucidate beautifully.
<http://www.amazon.co.uk/Programming-In-Scala-2nd-Edition/dp/0981531644/ref=sr_1_1?s=books&ie=UTF8&qid=1340897990&sr=1-1>
So how is this language useful to the change-ringing composer? I'd like
to show some examples of how simple, concise and quick Scala can be,
lifted from the code I wrote for the Helixoid project. As explained
yesterday, the project started off with a simple search for Helixoid
methods, but soon evolved into a fairly complex series of pipelines
which re-processed those methods already found, in order to extract
candidates which passed a series of requirement filters, including (a)
having no negative cross-falseness with Plain Bob, and (b) possessing
interesting course-splices. In all these tasks Scala proved beautifully
suitable and efficient. It enabled me to try things rapidly and make
progress in places where, with other languages, the coding barrier might
have been too high for my limited spare time.
I will break down my discussion into a series of articles in order to
reduce the length of each email. In the first article, which I'll send
shortly, I'll show how Scala's functional programming style can
dramatically simplify the job of writing machine searches. Happy to take
questions, and to hear anyone else's experience of using the language.
MBD
More information about the ringing-theory
mailing list