[Haskell] Monadic Loops

2004-06-17 Thread Vivian McPhail
Hi, I've implemented a Neural Net simulator which needs to repeat a training loop many times. For this I used a while function: while test body = do (cond,res) <- body if (test cond) then do rs <- while test body retur

Re: [Haskell] Monadic Loops

2004-06-17 Thread Georg Martius
Hi, On Thu, 17 Jun 2004 21:19:17 +1200, Vivian McPhail <[EMAIL PROTECTED]> wrote: Hi, I've implemented a Neural Net simulator which needs to repeat a training loop many times. It seams we are doing the same thing. I will share my one quite soon. For this I used a while function: while test body = d

RE: [Haskell] Annoying naming clashes

2004-06-17 Thread Stefan Holdermans
Ben, BY> it is nice to use 'maybe', 'either' functions. However, with BY> data types with more than 2 constructors, using such function BY> tends to be tedious than pattern match, where, you can pick BY> specific constructors of interest. BY> And in order to use pattern match, I hav

Re: [Haskell] Monadic Loops

2004-06-17 Thread Johannes Waldmann
while test body = do (cond,res) <- body if (test cond) then do rs <- while test body return (res:rs) else return [res] do you need the monad here? what monad is it? the problem could to be that the "return

Re: [Haskell] Monadic Loops

2004-06-17 Thread Peter Robinson
On Thursday 17 June 2004 12:39, Johannes Waldmann wrote: > > while test body = do > > (cond,res) <- body > > if (test cond) then do rs <- while test body > > return (res:rs) > > else return [res] > > do you

[Haskell] ICTAC 2004: Extended Deadline (5 July)

2004-06-17 Thread Bernhard K. Aichernig
* Extended Deadline (5 July) * ICTAC 2004 FIRST INTERNATIONAL COLLOQUIUM ON THEORETICAL ASPECTS OF COMPUTING Guiyang, China 20 - 24 September 2004 http://www.iist.unu.edu/ICTAC2004 IMPORTANT DATES Submission de

Re: [Haskell] Monadic Loops

2004-06-17 Thread Arjan van IJzendoorn
Hello, Vivian uses this while function: while test body = do (cond,res) <- body if (test cond) then do rs <- while test body return (res:rs) else return [res] > However, when I run the program, the interp

Re: [Haskell] Monadic Loops

2004-06-17 Thread Gustavo Villavicencio
An interesting paper on Monads and Recursion is "Merging Monads and Folds for Functional Programming" Erik Meijer and Johan Jeuring best regards, gustavo Peter Robinson said: > On Thursday 17 June 2004 12:39, Johannes Waldmann wrote: >> > while test body = do >> > (cond,res) <-

[Haskell] HsDNS -- asynchronous DNS resolver

2004-06-17 Thread Peter Simons
On top of the GNU adns library, I have implemented a pretty simple-to-use DNS resolver, which hides the concurrency from the user through the use of MVars. I thought, maybe someone found this useful. You can get the source code at: http://cryp.to/hsdns/ Peter __

Re: [Haskell] HsDNS -- asynchronous DNS resolver

2004-06-17 Thread Tomasz Zielonka
On Thu, Jun 17, 2004 at 02:20:49PM +0200, Peter Simons wrote: > On top of the GNU adns library, I have implemented a pretty > simple-to-use DNS resolver, which hides the concurrency from > the user through the use of MVars. I thought, maybe someone > found this useful. You can get the source code a

[Haskell] Space behaviour & hyperseq

2004-06-17 Thread Arjan van IJzendoorn
Hello Haskellers, I supervise a student who uses Haskell for simulating neural nets. A lot of computation goes on there and the program cannot handle as many iterations as we would like. We have improved performance by a factor of more than ten by putting strictness annotations in all data types.

Re: [Haskell] Space behaviour & hyperseq

2004-06-17 Thread Amanda Clare
1) Is there a more efficient definition of hyperseq that does not traverse the data structure twice? The "show" function traverses the structure once but I found it to be much slower. I think DeepSeq is what you're looking for. I've had all these problems and more and written down the advice peop

Re: [Haskell] Space behaviour & hyperseq

2004-06-17 Thread Johannes Waldmann
1) Is there a more efficient definition of hyperseq that does not traverse the data structure twice? The "show" function traverses the structure once but I found it to be much slower. persumably because it produces its output with (++), or with (.) and building up lots of closures (?) something li

Re: [Haskell] Space behaviour & hyperseq

2004-06-17 Thread Scott Turner
On 2004 June 17 Thursday 08:45, Arjan van IJzendoorn wrote: > function hyperseq and then applying it before the next iterations > begins: > hyperseq x y = if x==x then y else error "this is very unlikely" > This is very expensive The concept of DeepSeq bothers me, because usually more limited use

[Haskell] Monadic Loops

2004-06-17 Thread Vivian McPhail
Hi, I've implemented a Neural Net simulator which needs to repeat a training loop many times. For this I used a while function: while test body = do (cond,res) <- body if (test cond) then do rs <- while test body return

Re: [Haskell] Monadic Loops

2004-06-17 Thread Ben . Yu
You may want to try tail-recursion version while test body = liftM reverse $ loop [] where loop acc = do (cond,res) <- body (if test cond then loop else return) (res:acc) Regards,

RE: [Haskell] Annoying naming clashes

2004-06-17 Thread David Menendez
Stefan Holdermans writes: > Well, you've just identified the well-known trade-off between > abstraction and induction. A language extension involving 'views' [4, > 1, 3] has been proposed [2] to deal with this issue. That proposal for views is eight years old. Has there been any movement towards

Re: [Haskell] Annoying naming clashes

2004-06-17 Thread John Meacham
On Thu, Jun 17, 2004 at 06:03:31PM -0400, David Menendez wrote: > Stefan Holdermans writes: > > > Well, you've just identified the well-known trade-off between > > abstraction and induction. A language extension involving 'views' [4, > > 1, 3] has been proposed [2] to deal with this issue. > > Th

Re: [Haskell] Annoying naming clashes

2004-06-17 Thread Alastair Reid
> [...] learn pattern guards, they are a really really useful > and universal extension to the language. Universal? Ah, universally implemented in GHC! -- Alastair Reid ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinf

Re: [Haskell] Annoying naming clashes

2004-06-17 Thread John Meacham
On Thu, Jun 17, 2004 at 11:55:56PM +0100, Alastair Reid wrote: > > > [...] learn pattern guards, they are a really really useful > > and universal extension to the language. > > Universal? > > Ah, universally implemented in GHC! really? for some reason I thought they were in nhc and hugs. alth