[erlang-questions] Help with tuple pattern match?

Hasan Veldstra <>
Wed Jun 18 21:19:36 CEST 2008


> answer? I interpreted the structure of this form of pattern matching as:
> 
> Person={person,{name,{first,joe},{last,armstrong}},{footsize,42}}.
> 
> {person,_,{name,_{first,_{last,_}},{footsize,_}=Person.
> 
> Is this correct? From left to right, one counts the atoms, i.e., 
> person,name,first,last,etc. and 'aligns' them with the underscores?

Underscore matches terms (e.g. whole tuples), not just atoms.



More information about the erlang-questions mailing list