Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-08 Thread Jackm139
Thanks for all the replies! I have it working somewhat. It works as long as there is only one string in each list, but if the lists contain more than one string it fails. here is what I have: import List same :: [[Char]] - [[Char]] - Bool same [xs] [ys] = map (normalize) [[xs]] == map

Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-08 Thread Justin Bailey
On Tue, Apr 8, 2008 at 10:24 AM, Jackm139 [EMAIL PROTECTED] wrote: import List same :: [[Char]] - [[Char]] - Bool same [xs] [ys] = map (normalize) [[xs]] == map (normalize) [[ys]] normalize :: [String] - [String] normalize [xs] = [(sort (nub xs))] Your pattern binding [xs] and [ys]

Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-08 Thread Henning Thielemann
On Tue, 8 Apr 2008, Jackm139 wrote: Thanks for all the replies! I have it working somewhat. It works as long as there is only one string in each list, but if the lists contain more than one string it fails. here is what I have: import List same :: [[Char]] - [[Char]] - Bool same [xs] [ys]

Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-07 Thread Krzysztof Kościuszkiewicz
On Mon, Apr 07, 2008 at 07:51:05PM -0700, Jackm139 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 My plan to tackle this was to use: nub to eliminate duplications, sort to

Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-07 Thread Stuart Cook
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

Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-07 Thread Dan Weston
I don't know how to calibrate my response to what you are really asking for. Depending on how new you are, maybe all you want is just working syntax to get you started. Here is a structurally similar problem, if it helps. (And if you are more advanced, try the extra credit!) Find the average

Re: [Haskell-cafe] testing for same characters in lists of strings

2008-04-07 Thread Henning Thielemann
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