dialyzer and non-proper lists

Vlad Dumitrescu <>
Fri Sep 16 11:56:04 CEST 2005


<wishful thinking mode>

It would be cool if patterns could be regular data structures too, so that
one could have
[$f, $o, $o | _] or [H | T] as proper Erlang terms.

Maybe even some confusing syntax could also appear: "foo"_ instead of "foo"
++ _

regards,
Vlad

----- Original Message ----- 
From: "Ulf Wiger (AL/EAB)" <>
To: <>
Sent: Friday, September 16, 2005 11:25 AM
Subject: dialyzer and non-proper lists


>
> It's been argued that non-proper lists can always be
> avoided at minimal expense.
>
> How about this example:
>
> 20> [ets:insert(T, {"foo-" ++ integer_to_list(N)}) || N <-
lists:seq(1,10)].
> [true,true,true,true,true,true,true,true,true,true]
> 21> ets:select(T, [{{"foo" ++ '_'},[],['$_']}]).
> [{"foo-6"},
>  {"foo-7"},
>  {"foo-3"},
>  {"foo-8"},
>  {"foo-2"},
>  {"foo-9"},
>  {"foo-10"},
>  {"foo-5"},
>  {"foo-4"},
>  {"foo-1"}]
>
>
> Never mind the ++. It expands before the select() call into
> [$f, $o, $o | '_'], which is still a non-proper list, and the way
> you're supposed to do it in ets:match() and ets:select()
>
> /Uffe
>



More information about the erlang-questions mailing list