Sat Jul 25 11:11:54 CEST 2009
2009/7/25 Johnny Billquist <>:
>>> It is little bit overcomplicated version of
>>> filterHelper([X], Int, Result) when X =< Int -> [X|Result];
>> Mmm. Thanks... I think :-)
>> (I'm trying to learn!)
>> Does that check for a list length of 1?
> A pattern of [X] can only match a list with one element.
Couldn't X be a variable which might be a tuple or ... almost anything?
Or is this pattern matching logic, that implies it is as you say?
> If the list have two elements, you'd have to write [X,Y] to match, and so
Yes. Two element list would require the comma
> If you want to match a list of unknown length, where you want to look at the
> first element, you should write [X|Y].
I'm getting used to that pattern, very useful!
XSLT XSL-FO FAQ.
More information about the erlang-questions