[erlang-questions] Sunday puzzle - trying to improve my Erlang

Richard Carlsson <>
Sun Jul 6 14:17:45 CEST 2008


Toby Thain wrote:
> Hi list,
> 
> I stumbled on this simple 'puzzle'[0] posted some years ago on  
> comp.lang.tcl (originally to an Icon mailing list).
> 
> After solving it in Icon[1] and SQL[2] I decided to see what an  
> Erlang solution would look like. I'm posting here firstly because  
> other people's solutions would be interesting, and also I'd like to  
> see how my own solution[3] could be improved.
> 
> Any takers over the weekend? :-)
> 
> --Toby
> 
> [0] http://groups.google.com/group/comp.lang.tcl/msg/8846d9f7491ba0ba
> [1] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/vn.icn
> [2] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/Makefile
> [3] http://telegraphics.com.au/svn/puzzles/trunk/vier-neun/erlang/

Here's my version. Note that it's often better to think in terms of
stages of list processing (mapreduce etc.), instead of inserting and
looking up in dictionaries. I tag each generated pair with the E
element, just to make the list easier to work with later.

     /Richard
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: solve.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080706/b13da205/attachment.ksh>


More information about the erlang-questions mailing list