[erlang-questions] Weird function match semantics

Matthew Dempsky <>
Fri Nov 16 23:48:21 CET 2007


I expect the following three expressions to evaluate to 'ok':

    (fun("X" ++ _) -> ok end)("X").
    (fun([$X | _]) -> ok end)("X").
    (fun([$X] ++ _) -> ok end)("X").

The first two meet my expectations, but the third exits with an
illegal_pattern exception.  Is this intentional or a bug?

Thanks.



More information about the erlang-questions mailing list