Pattern matching: Skipping the rest of a tuple
Sean Hinde
sean.hinde@REDACTED
Thu Dec 29 01:33:58 CET 2005
On 28 Dec 2005, at 19:19, Joel Reymont wrote:
> Folks,
>
> Is it possible to write a function to pattern-match on tuples of
> various sizes _without_ using element(X, Tuple)?
>
> I'm dealing with records of different length and would like to say
> things like
>
> match({record1, _, 20, _/rest}) -> ...
> match({record2, 30, _/rest}) -> ...
> etc.
Isn't this as simple as:
match(#record1{b=20}) ->
match(#record2{a=30}) ->
Sean
More information about the erlang-questions
mailing list