[r-t] Writing method display software

Alexander Holroyd holroyd at math.ubc.ca
Sat Nov 28 21:11:33 UTC 2015


I'm interested to learn what programming languages people are using for 
ringing software, and (more imporantly) why.  I do not have any experience 
with Scala.  I have been mostly using Python recently, and, in comparison, 
every other language I see now looks hopelessly fussy and arcane to me. 
I find the python syntax extremely helpful, perhaps because it is very 
close to standard mathematical notation, which tends to be optimized for 
human readabaility.

E.g. in python, testing for a jump change (as described below) would be

def isjump(p):
   return any(abs(i-x)>1 for (i,x) in enumerate(p))

and composing two changes is

def mul(p,q):
   return [p[x] for x in q]

Does one of you (Alan, Mark,...) want to explain to me why (e.g.) Scala 
might be better for some purposes?  I'm not being awkward (for once?) - I 
just want to learn...

cheers, Ander

> Alan Burlison writes,
>
A simple example is figuring out if a change has any jump changes in
it - assuming I've picked up what they are correctly, i.e. where a
bell moves by more than one place.  Rather than iterating over the
places in the change individually, a more functional way of doing this
is to convert each place in the change into a pair, so for example the
first change of plain hunt on 6 is transformed from (2,1,4,3,6,5) to
((2,1),(1,2),(4,3),(3,4),(6,5),(5,6)), then the two halves of each
pair are subtracted and the absolute value taken, then any values that
are more than 1 are filtered out to yield the list of changes that
move by more than one place.  In Scala that's:

positions.zipWithIndex.filter( p => math.abs(p._1 - (p._2 + 1)) >
1).map(_._2)

On Sat, 31 Oct 2015, Mark Davies wrote:

> Good man! Scala is the business for bellringing problems (as for much else, 
> of course).




More information about the ringing-theory mailing list