[erlang-questions] Matching binaries and shadowed variables

Ivan Uemlianin ivan@REDACTED
Fri Nov 29 13:10:31 CET 2013


ah yes my mistake.

On 29/11/2013 11:54, Anthony Ramine wrote:
> No, the A in the function clause is fresh and shadows the previous A.
>
>> lists:map(fun (<<A:ASize/binary, _/binary>>) -> match; (_) -> nomatch end, [<<"foobar">>]).
> [match]
>
> And if it did not shadow the previous A binding, the closure would return nomatch for <<"nohello">> because it does not begin with hello.
>

-- 
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development

                     ivan@REDACTED
                      www.llaisdy.com
                          llaisdy.wordpress.com
               github.com/llaisdy
                      www.linkedin.com/in/ivanuemlianin

                         festina lente
============================================================



More information about the erlang-questions mailing list