On Tue, Apr 8, 2008 at 1:51 PM, Jackm139 <[EMAIL PROTECTED]> wrote:
>  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

I would start with something smaller: try defining a function that
will check if two *strings* use the same characters. It would look
something like this:

  same :: String -> String -> Bool
  same xs ys = normalize xs == normalize ys

  normalize :: String -> String
  normalize xs = error "insert your implementation here"

Define the "normalize" function so that it does whatever is necessary
to make two strings with the same characters into the same string
(using nub, sort, and/or whatever else is appropriate).

Once you have the "same" function working, you can use it to define
"sameCharacter". You might want to take a look at the functions "zip",
"zipWith", "all", and "and", which can be found in the Prelude.

Hopefully this will help you get started.


Stuart
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to