Shadowed head variable in fun

WILLIAMS Dominic D.WILLIAMS@REDACTED
Fri May 23 14:07:16 CEST 2003


Hello,

How does one 'consume' a head variable in a fun?

symbol(Char) when integer(Char) ->
	fun([Char|Rest]) -> [{Rest,Char}];
	   (Other) -> []
	end.

This compiles with a Warning: variable 'Char' shadowed in 'fun'.
And doesn't do what I want...

i.e.

F = symbol($a),
F("Hello").

returns [{"ello",72}] (I want it to return []).

Thanks for your help,

Dominic.



More information about the erlang-questions mailing list