[Haskell-beginners] Updating lists inside another list

Aaron MacDonald aaronjm at eastlink.ca
Mon Jun 22 20:05:36 EDT 2009


I have a list of pairs. Each pair has a value and a list. So, the  
structure looks like this:

[ (a, [b, c]), (b, [a, c]) ]

What I want to do is be able to add an element to the inner list of  
the pair with the head value of my choosing.  So, for the above list:

 > addToInnerList [ (a, [b, c]), (b, [a, c]) ] a d
[ (a, [b, c, d]), (b, [a, c]) ]


More information about the Beginners mailing list