[erlang-questions] Help with tuple pattern match?

David Mercer dmercer@REDACTED
Wed Jun 18 20:42:36 CEST 2008


1> Person={person,{name,{first,joe},{last,armstrong}},{footsize,42}}.

{person,{name,{first,joe},{last,armstrong}},{footsize,42}}

2> {_,{_,_,{_,Last}},_} = Person.

{person,{name,{first,joe},{last,armstrong}},{footsize,42}}

3> Last.

armstrong

 

  _____  

From: erlang-questions-bounces@REDACTED
[mailto:erlang-questions-bounces@REDACTED] On Behalf Of Caitlin Gibbons
Sent: Wednesday, June 18, 2008 13:37
To: erlang-questions@REDACTED
Subject: [erlang-questions] Help with tuple pattern match?

 

Hi all.

I'm looking at:

Person={person,{name,{first,joe},{last,armstrong}},{footsize,42}}.

and trying to extract the value of 'last', i.e., 'armstrong'.

{_,{_,{_,{_,Last},_}=Person.

was unsuccessful. Any help?

Thanks,

Caitlin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080618/a248792f/attachment.htm>


More information about the erlang-questions mailing list