On Mon, 7 Apr 2008, Jackm139 wrote:


I'm new to Haskell, and I'm finding it is very different from any other
language I have worked with.

I have an assignment to make a program to test whether two lists use the
same characters for each string.
e.g.

sameCharacter ["rock", "cab"] ["cork", "abc"]
True

My plan to tackle this was to use:
nub to eliminate duplications,
sort to put the characters in order,
and map to put characters together.. and then somehow check to see if these
characters are the same.

How about converting the strings to Set Char and comparing the resulting lists?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to