Re: [Haskell-cafe] Decorating a list of strings

2006-11-03 Thread Chris Kuklewicz
Steve Schafer wrote: I have a list of text strings: [Alice, Bob, Cindy, Bob, Bob, Dave, Cindy] As you can see, some of the strings occur only once; others appear two or more times. I would like to end up with a new list, according to the following rules: 1) If a string occurs only

Re[4]: [Haskell-cafe] Class

2006-11-03 Thread Bulat Ziganshin
Hello Slavomir, Thursday, November 2, 2006, 5:51:17 PM, you wrote: I wouldn't like to manually define instances of Visible for all types that have Show instances. believe it or not but i had the same problems I think I need something like that: class Visible a where instance Show a =

Re: [Haskell-cafe] Non-integer part of a Double

2006-11-03 Thread Henning Thielemann
On Thu, 2 Nov 2006, Sebastian Sylvan wrote: On 11/2/06, Maurí­cio [EMAIL PROTECTED] wrote: Hi, Is there a function to get that? I'm using \x - x - fromIntegral(floor x) since I was not able to find something better, but I guess I have missed something in the standard

Re[2]: [Haskell-cafe] Class

2006-11-03 Thread Bulat Ziganshin
Hello Slavomir, Thursday, November 2, 2006, 9:59:38 PM, you wrote: one is okay, though, but you have to start ghc with -fallow-undecidable-instances and -fglasgow-exts I'm afraid. Thanks, Sebastian. That was helpful. Are there any papers on the subject? i recommend you to read in the

Re: Fwd: [Haskell-cafe] Class

2006-11-03 Thread Bulat Ziganshin
Hello Slavomir, Thursday, November 2, 2006, 5:47:37 PM, you wrote: class Show a = Visible a where toString :: a - String toString = show size :: a - Int size = length . show it's not that you need. it's definition of subclass, say class Set a = OrderedSet a -- Best

Re[2]: [Haskell-cafe]Prime Generator time limit exceeded

2006-11-03 Thread Bulat Ziganshin
Hello alaiyeshi, Thursday, November 2, 2006, 9:26:37 PM, you wrote: I've met replicateM_ for the first time;-) This could be a template for doing online-judge exercises I guess. And it's very useful for newbies like me. make an date for 'interact' :))) -- Best regards, Bulat

Re[2]: [Haskell-cafe] How to improve speed? (MersenneTwister is several times slower than C version)

2006-11-03 Thread Bulat Ziganshin
Hello Donald, Thursday, November 2, 2006, 2:21:31 PM, you wrote: 10-20 times difference is typical for GHC programs. It's really more like 2-4x. Sometimes better than C. Where's this huge figure coming from Bulat? If you have code that behaves like this, you should report it. are you

Re: Re[2]: [Haskell-cafe] Class

2006-11-03 Thread Slavomir Kaslev
On 11/3/06, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Slavomir, Thursday, November 2, 2006, 9:59:38 PM, you wrote: one is okay, though, but you have to start ghc with -fallow-undecidable-instances and -fglasgow-exts I'm afraid. Thanks, Sebastian. That was helpful. Are there any papers

[Haskell-cafe] Re: Non-integer part of a Double

2006-11-03 Thread Maurí­cio
Henning Thielemann wrote: On Thu, 2 Nov 2006, Sebastian Sylvan wrote: On 11/2/06, Maurí­cio [EMAIL PROTECTED] wrote: Hi, Is there a function to get that? I'm using \x - x - fromIntegral(floor x) since I was not able to find something better, but I guess I have missed something in the

Re: Re[2]: [Haskell-cafe]Prime Generator time limit exceeded

2006-11-03 Thread alaiyeshi
Wow! Thank you for your suggestion. But I guess in this problem the first input line and the other are different in their meaning. Thus if I use interact I should parse the input(again), I guess.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Cost of seq (sorry about the old subject)

2006-11-03 Thread Malcolm Wallace
Chad Scherrer [EMAIL PROTECTED] wrote: afaik, seq cost is zero (except for evaluating expressions, of course) So if x has already been evaluated, does x `seq` y evaluate just as quickly as y alone, or does it require extra cycles to make sure x has been evaluated? My understanding is

Re[4]: [Haskell-cafe]Prime Generator time limit exceeded

2006-11-03 Thread Bulat Ziganshin
Hello alaiyeshi, Friday, November 3, 2006, 4:23:40 PM, you wrote: But I guess in this problem the first input line and the other are different in their meaning. Thus if I use interact I should parse the input(again), I guess. it seems that you don't understand that functional programming