Re: [Haskell-cafe] newbie question on ordering

2007-04-23 Thread Joe Thornber
On 22/04/07, Nikolay Metchev <[EMAIL PROTECTED]> wrote: Hello guys, I have decided to try and get back into Haskell recently. I have used it in the past but have forgotten large chunks. I am trying to express the logic of a particular card game. For this purpose I need to be able to order cards i

Re: [Haskell-cafe] Multi Line String literals

2007-04-26 Thread Joe Thornber
On 26/04/07, Bas van Dijk <[EMAIL PROTECTED]> wrote: test = putStrLn $ toIsString $ do "I" "need" "MultiLine" "String"

Re: [Haskell-cafe] Mathematica

2007-05-11 Thread Joe Thornber
On 11/05/07, Andrew Coppin <[EMAIL PROTECTED]> wrote: Hi folks. How difficult would it be to implement Mathematica in Haskell? The language itself; very easy I'd say. The maths libraries ... years. So if you just want something to play with I'm sure you could get something working quickly.

Re: [Haskell-cafe] Debunking tail recursion

2007-05-18 Thread Joe Thornber
This page [1] has useful info on it. Having done a lot of lisp/ocaml before coming to Haskell I was also very attached to tail recursion; it took a long time to realise this was wrong. This topic definitely needs more prominence on the wiki. - Joe [1] http://www.haskell.org/haskellwiki/Stack_o

Re: [Haskell-cafe] Newbie: generating a truth table

2007-02-21 Thread Joe Thornber
On 2/10/07, Peter Berry <[EMAIL PROTECTED]> wrote: Prelude> putStrLn $ concatMap (flip (++)"\n") $ map show $ [(x,y,(&&) x y) |x <- [True,False],y <- [True,False]] This can be simplified slightly to: Prelude > putStrLn . unlines . map show $ [(x, y, x && y) | x <- [True, False], y <- [True, Fal

Re: [Haskell-cafe] Code and Perf. Data for Prime Finders (was: Genuine Eratosthenes sieve)

2007-02-22 Thread Joe Thornber
On 22/02/07, Melissa O'Neill <[EMAIL PROTECTED]> wrote: But talk is cheap. What about some actual numbers, and some code for some actual implementations...? Perhaps you could go the last 1% and upload a Primes package to Hackage and forever save us from inferior sieves ? (I enjoyed your paper

Re: [Haskell-cafe] Re: process

2007-02-23 Thread Joe Thornber
On 23/02/07, Thomas Hartman <[EMAIL PROTECTED]> wrote: This seemed like a handy thing to have an example of, so I added it to my growing repo of sample haskell programs and tried running it. But I was unsuccessful. Your program works for me both compiled or using runghc: Linux lonlsd62 2.6.9-1

Re: [Haskell-cafe] Haskell spacing problem.

2007-03-09 Thread Joe Thornber
On 09/03/07, Frozz <[EMAIL PROTECTED]> wrote: Hi Haskell ppl, I'm trying to solve a problem that had been bothering me for a long time. I'm trying to create index and display the index in Hugs as well as an output text file. dispTable is a pure function so you'll get the same result irrespecti

Stack usage with a state monad

2003-12-30 Thread Joe Thornber
Hi, I was wondering if anyone could give me some help with this problem ? I'm trying to hold some state in a StateMonad whilst I iterate over a large tree, and finding that I'm running out of stack space very quickly. The simplified program below exhibits the same problem. This is the first tim

Re: Stack usage with a state monad

2003-12-30 Thread Joe Thornber
On Tue, Dec 30, 2003 at 08:28:11PM +0100, Tomasz Zielonka wrote: > On Wed, Dec 31, 2003 at 02:54:18AM +0900, Koji Nakahara wrote: > > Hi, > > > > I think the problem is in the State Monad itself; > > State Monad is lazy to compute its state. > > > > I am not a haskell expert, and there may be bet

Re: Stack usage with a state monad

2003-12-31 Thread Joe Thornber
On Wed, Dec 31, 2003 at 11:54:27AM +, Graham Klyne wrote: > My *intuition* here is that the problem is with countLeaves2, in that it > must build the computation for the given [sub]tree before it can start to > evaluate it. Maybe this is why other responses talk about changing the > state m

Re: Stack usage with a state monad

2003-12-31 Thread Joe Thornber
On Wed, Dec 31, 2003 at 02:38:06PM +, Graham Klyne wrote: > getOrCachePositionValue pos = > do { mcache <- gets (findPos pos) -- Query cache for position >; case mcache of >Just cached -> return (cachedVal cached) -- Return cached value >Nothing ->

Re: Stack usage with a state monad

2004-01-02 Thread Joe Thornber
On Fri, Jan 02, 2004 at 02:46:04PM +, Graham Klyne wrote: > If your calculation really needs to update the cache state as it goes > along, then I agree that it needs to be run in the state monad. But even > then, I'd be inclined to look for sub-calculations that can be evaluated as > ordina