hassy's blog

Fun with function names in Erlang

Wed, 30 Jan 2008 - permalink

(From the department of “cool, but useless”)

This is valid Erlang code:


-module(aoeui).
-compile(export_all).

'___'() ->
    io:format("___~n").

'<<@@>>'() ->
    io:format("<<@@>>~n").

'!@#$%^&*(){}'() ->
    io:format("!@#$%^&*(){}~n").

'_абвгд_'() ->
    io:format("_абвгд_~n").

This is of course due to the fact that functions in Erlang are identified by atom and arity pairs, which means that any valid atom is a valid function name.

Sadly, the only opportunity to use these with clear conscience is the next Obfuscated Erlang Competition. :(