Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread Thomas Hartman
could someone explain sharing? In the code below, allstrings2 is 6X as fast as allstrings. I assume because of sharing, but I don't intuitively see a reason why. can someone give me some pointers, perhaps using debug.trace or other tools (profiling?) to show where the first version is being

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread Miguel Mitrofanov
Well, I'm hardly the one knowing GHC internals, but... In allstrings you continue calling strings with same arguments again and again. Don't fool yourself, it's not going to automagically memorize what you were doing before. In fact, I'd expect much more speed loss. If you increase your

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread wren ng thornton
Thomas Hartman wrote: could someone explain sharing? In the code below, allstrings2 is 6X as fast as allstrings. I assume because of sharing, but I don't intuitively see a reason why. can someone give me some pointers, perhaps using debug.trace or other tools (profiling?) to show where the

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-20 Thread Matthew Brecknell
Thomas Hartman wrote: could someone explain sharing? A good tool for visualising the difference between shared and non-shared results would be vacuum, using one of its front ends, vacuum-cairo or vacuum-ubigraph. http://hackage.haskell.org/package/vacuum

Re: [Haskell-cafe] Re: Need some help with an infinite list - Ouch

2009-06-18 Thread Lee Duhem
On Wed, Jun 17, 2009 at 7:30 PM, GüŸnther Schmidtgue.schm...@web.de wrote: Hi all, you have come up with so many solutions it's embarrassing to admit that I didn't come up with even one. I have the similarly difficulties, but I found to understand some of these answers, equational reasoning

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-18 Thread Tom Pledger
Daniel Peebles pumpkingod at gmail.com writes: My solution attempted to exploit this using Numeric.showIntAtBase but failed because of the lack of 0 prefixes in the numbers. If you can find a simple way to fix it without duplicating the showIntAtBase code, I'd be interested! Another

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-18 Thread Matthew Brecknell
On Thu, 2009-06-18 at 23:57 +0800, Lee Duhem wrote: [...] I have prepared a blog post for how I worked out some of these answers, here is the draft of it, I hope it can help you too. Nice post! Certainly, pen-and-paper reasoning like this is a very good way to develop deeper intuitions.

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-18 Thread Lee Duhem
On Fri, Jun 19, 2009 at 6:17 AM, Matthew Brecknellhask...@brecknell.org wrote: On Thu, 2009-06-18 at 23:57 +0800, Lee Duhem wrote: [...] I have prepared a blog post for how I worked out some of these answers, here is the draft of it, I hope it can help you too. Nice post! Certainly,

[Haskell-cafe] Re: Need some help with an infinite list - Ouch

2009-06-17 Thread GüŸnther Schmidt
Hi all, you have come up with so many solutions it's embarrassing to admit that I didn't come up with even one. Günther GüŸnther Schmidt schrieb: Hi guys, I'd like to generate an infinite list, like [a, b, c .. z, aa, ab, ac .. az, ba, bb, bc .. bz, ca ...] When I had set out to do

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread Tom Pledger
GüŸnther Schmidt gue.schmidt at web.de writes: Hi guys, I'd like to generate an infinite list, like [a, b, c .. z, aa, ab, ac .. az, ba, bb, bc .. bz, ca ...] If you're happy to have a before the a, you can do this as a fairly cute one-liner in a similar style to this list of

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread GüŸnther Schmidt
Dear Ross, thanks for your post, you got it almost right, I needed something like aa, ab, ac ... It seems that Thomas has figured it out. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread GüŸnther Schmidt
Hi Thomas, thanks, it seems you found it. I find it a bit embarrassing that I was unable to figure this out myself. Günther Thomas Davie schrieb: letterCombos = map (:[]) ['a'..'z'] ++ concatMap (\c - map ((c++) . (:[])) ['a'..'z']) letterCombos Not hugely efficient, if you generate the

Re: [Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread Ross Mellgren
Oh sorry about that, misread the problem. -Ross On Jun 16, 2009, at 9:16 PM, GüŸnther Schmidt wrote: Dear Ross, thanks for your post, you got it almost right, I needed something like aa, ab, ac ... It seems that Thomas has figured it out. Günther

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread GüŸnther Schmidt
Hi Tom, thanks for that. I remembered reading about that in my earliest haskell days, couldn't find it again and couldn't get it right by myself either. Günther Tom Pledger schrieb: GüŸnther Schmidt gue.schmidt at web.de writes: Hi guys, I'd like to generate an infinite list, like [a,

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread GüŸnther Schmidt
Hi Ross, no problem at all, I certainly appreciate it. Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Need some help with an infinite list

2009-06-16 Thread GüŸnther Schmidt
Hi Richard, I'd have to guess here :) Maybe, what you have in mind, is: generate an infinite list with numbers from [1 ..], map it to base 26? Günther Richard O'Keefe schrieb: On 17 Jun 2009, at 12:28 pm, GüŸnther Schmidt wrote: Hi guys, I'd like to generate an infinite list, like