Phone mnemonics in Erlang

September 06, 2012 | 1 Minute Read

Edit: too much rush, looks like the code may need a slight addition, I will update it later…

So, after Martin Odersky’s lesson and its example of phone mnemonics (inspired by this article), I spent a little time and wrote an implementation in Erlang.

It may not be the best one, but it seems to work; you can find it here, for using it you need to fill in the WORDS constant with the strings which you can translate from numbers and call the translate method passing a number as string (i.e., mnemonics:translate(“5828″)).

The code follows the solution provided by Martin in his slides, maybe the code could be even more compact by using a different workflow, but I’m not sure.