Lists search by first element of a tuple

Peter Lund <>
Wed Feb 8 12:21:43 CET 2006


Mats Cronqvist wrote:

>
>> 1> [X||{1,_}=X<-[{2,3},{1,4},b,{1,7},c]].
>> [{1,4},{1,7}]
>> 2> [X||X={1,_}=<-[{2,3},{1,4},b,{1,7},c]].
>> ** 1: variable '_' is unbound **
>
>   because of the typo ( =<- )?

Yes, that it was!

[X||X={1,_}<-[{2,3},{1,4},b,{1,7},c]]. worked as it should!  :)

/Peter




More information about the erlang-questions mailing list