[erlang-questions] List matching, help me make this look better

Ulf Wiger ulf.wiger@REDACTED
Sat Apr 25 23:19:23 CEST 2009


Jarrod Roberson wrote:
>       myfunc("aaaa" ++ _) ->
>           io:format("matched aaaa~n");
> 
>     instead.  Works also as:
> 
>       myfunc("aaaa " ++ R) ->
>           io:format("matthed aaaa~n"),
>           io:format("R matches 123 in your example file");
> 
> 
> can somebody explain what the ++ operator is called and is doing there?

"aaaa" ++ R is syntactic sugar for [$a,$a,$a,$a|R].

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com



More information about the erlang-questions mailing list