Re: Ex 9.9 in Paul Hudak's book

2002-04-03 Thread Tom Bevan
Thanks Olaf, I'll follow up your references. Tom On Wed, 3 Apr 2002 21:40, Olaf Chitil wrote: > Tom Bevan wrote: > > What I would like to know is how the 'fix' function could be used > > to find the fixed point of a function like ( \n -> 2*n ). > > > &

Re: Ex 9.9 in Paul Hudak's book

2002-04-02 Thread Tom Bevan
I've been watching the discussion of the fixed point function with interest. In Antony's example, > factGen = \f -> \n -> if n==0 then 1 else n * f (n-1) The fixed point of factGen is clearly n! because 0! = 1 and n! = n * (n-1) * (n-2) * .. * 1 = n * ( (n-1)! ) = n * f (n-1) so the factGen tra

Continuation Passing Style

2002-03-14 Thread Tom Bevan
I noticed that Ralf Hinze posted a CPS monad yesterday. Would someone be kind enough to post a simple example of a function that uses CPS. Thanks Tom ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

(no subject)

2002-02-24 Thread Tom Bevan
Hi, I've come across this sort of data constructor below many times but I'm not really sure how to use it. Can someone please point me to the right section in the documentation? In particular, I want to know how to create a calendar time and how to access the fields . Tom data CalendarTime =

Eager IO function

2002-02-12 Thread Tom Bevan
How should I modify the function below so that characters are printed out as they arrive? Thanks. Tom printchar :: Handle -> IO () printchar handle = do c <- hGetChar handle putChar c ___ Haskell-Cafe mailing list [EMAIL P

Re: Monad composition

2002-01-23 Thread Tom Bevan
he right track. Tom On Thu, 2002-01-24 at 14:32, Andre W B Furtado wrote: > Hi, I have the same problem. Did anyone answered your question? > > Thanks, > -- Andre > > ----- Original Message - > From: Tom Bevan <[EMAIL PROTECTED]> > To: Haskell Cafe List <[

Re: Regarding finding the number of unique elements in a list.

2002-01-17 Thread Tom Bevan
I consider myself a newbie too but here are my solutions Tom On Fri, 2002-01-18 at 10:14, Amrit K Patil ;012;VKSF6; wrote: > > Hi, > > I am newbie at Haskell. > > I am not able to write a program to find the number of unique elments in a > list in haskell. > > I am also not able to write a

Help using a state monad

2002-01-13 Thread Tom Bevan
Hi all, I'm trying to get a feel for how monads might be used in a Haskell program and develop an approach that would be useful for larger projects. I have tried to model in miniture a programme which takes input from 'standard in' and processes it against an internal state and then returns the

RE: Compiler error using IO

2002-01-06 Thread Tom Bevan
On Sat, 2002-01-05 at 05:03, Zhanyong Wan wrote: > Hi, > > Ashley Yakeley wrote: > > | The "layout" rules drive me nuts. You might prefer using parentheses and > | semicolons, as I do: > > I guess the point behind the layout rules is that anything violating such > rules is considered bad progra

Compiler error using IO

2002-01-03 Thread Tom Bevan
When trying to right IO I continually run across this sort of compile error which I just don't understand. Any help would be very muich appreciated. Function: while :: IO Bool -> IO () -> IO () while test action = do res <- test if res then do action