Shadowed head variable in fun

WILLIAMS Dominic D.WILLIAMS@REDACTED
Fri May 23 14:19:10 CEST 2003


That's perfect, thanks very much!

> -----Original Message-----
> From: Ulf Wiger [mailto:etxuwig@REDACTED]
> Sent: Friday, May 23, 2003 2:14 PM
> To: WILLIAMS Dominic
> Cc: Erlang (E-mail)
> Subject: Re: Shadowed head variable in fun
> 
> 
> 
> The Char in the fun's function head is not the same as Char
> in the surrounding scope (thus the warning). The simplest
> way to amend your implementation is probably:
> 
> symbol(Char) when integer(Char) ->
>    fun([C|Rest]) when C == Char -> [{Rest,Char}];
>       (Other) -> []
>    end.
> 
> I haven't verified absense of typos in the above code, but
> you probably get the idea.
> 
> /Uffe



More information about the erlang-questions mailing list