Trying to understand tuples and lists
kaykaydreamz at yahoo.com
Wed Nov 5 03:07:24 EST 2003
I got get this working thanks to the fst and snd function.
--- Karthik Kumar <kaykaydreamz at yahoo.com> wrote:
> I have a list of tuples ( characters and numbers ) .
> say, [('a', 1), ('b', 2)]
> I want to extract 'a' and 1 separately .
> (x,y) <- head [('a', 1), ('b', 2)]
> This doesnt work but my idea is to get x contain the value 'a' and
> contain the value 1 as the first tuple in the list.
> Which is the right way of doing this. Thanks for your help.
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
More information about the Haskell-Cafe