the problem of using _Var instead of _

Vlad Dumitrescu vlad_dumitrescu@REDACTED
Fri Mar 4 08:46:24 CET 2005


From: "Bengt Kleberg" <bengt.kleberg@REDACTED>
> fun( [H1|_T], [H2|_T] ) ->
> {H1, H2}.
> and it crashed with {function_clause,...}. however this works:

Hi,

Could it be that you really meant to write
    fun( [H1|_T1], [H2|_T2] ) ->
    {H1, H2}.
?

Using _ matches different tails, but using _T only matches if the tails are
identical.

regards,
Vlad



More information about the erlang-questions mailing list