Simple clojure solution using core.match
Simple erlang solution