[Haskell-cafe] bit of a noob question

spot135 aca08sas at shef.ac.uk
Sat Oct 24 18:27:50 EDT 2009

Ok maybe a noob question, but hopefully its an easy one.

This is what I've got so far:

test :: x->[a] -> (b,[b])
test x arrlist = let test1 = x
		         a = filter (\n -> fst n == test1) arrlist
		        test2 = map snd a  
	           in (test1, [test2])

so basically I have a list say [(a,1),(a,2),(a,3),(b,1),(b,2)] etc
So I give the function a x value (a or b) in this case and it return

which is all gravy

Is there a way that i dont have to supply the a or b ie i call the function
and it gives me the list

I presume i need another layer of recursion but I cant figure out how to do

Any help would be gratefully received :-)

View this message in context: http://www.nabble.com/bit-of-a-noob-question-tp26043671p26043671.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list