Re: [Haskell] Monadic Loops

2004-06-18 Thread John Hughes
Vivian McPhail wrote: 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

Re: [Haskell] Monadic Loops

2004-06-17 Thread Ben . Yu
TECTED] ise.net.nz> cc: Sent by: Subject: [Haskell] Mona

[Haskell] Monadic Loops

2004-06-17 Thread Vivian McPhail
and there is a maximum ?stack size. Is there a better way to implement (possibly infinite) loops in Haskell? ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: [Haskell] Monadic Loops

2004-06-17 Thread Gustavo Villavicencio
> http://haskell.org/hawiki/TailRecursive > >> >> could you produce a (lazy) list of results instead? >> the garbage collector might be able to collect >> the list cells that are no longer needed >> >> possibly, a lazy state monad would help >> (if

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 Peter Robinson
d help > (if the computation of "while test body" cannot fail) > > > Is there a better way to implement (possibly infinite) loops in Haskell? You could have a look at "Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Hask

Re: [Haskell] Monadic Loops

2004-06-17 Thread Johannes Waldmann
e list cells that are no longer needed possibly, a lazy state monad would help (if the computation of "while test body" cannot fail) Is there a better way to implement (possibly infinite) loops in Haskell? generally, don't program your own recursions - use pre-defined combinators

Re: [Haskell] Monadic Loops

2004-06-17 Thread Georg Martius
actually force it to. In case your condition (cond) doesn't force the evaluation of all transformations you get large unevaluated stuff in you memory. Is there a better way to implement (possibly infinite) loops in Haskell? I' am curious as well! Cheers, Georg -- Georg Martius, Te

[Haskell] Monadic Loops

2004-06-17 Thread Vivian McPhail
and there is a maximum ?stack size. Is there a better way to implement (possibly infinite) loops in Haskell? ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

Re: LOOPS

2003-06-11 Thread Tomasz Zielonka
On Wed, Jun 11, 2003 at 09:39:24AM -0700, Hal Daume III wrote: > It depends how much you mean "like" :). Usually whatever you would solve > using a while loop in an imperative language is solved with recursion in > Haskell. > > The problem with directly having 'while' is that such a statement > d

Re: LOOPS

2003-06-11 Thread Hal Daume III
It depends how much you mean "like" :). Usually whatever you would solve using a while loop in an imperative language is solved with recursion in Haskell. The problem with directly having 'while' is that such a statement depends necessarily on mutable variables (otherwise, if the condition is 'tr

LOOPS

2003-06-11 Thread Filip
I have a stupid question :) Is there something like "while" loop in GHC ?? Thanks very much :) ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell

LOOPS

2003-06-11 Thread Filip
I have a stupid question :) Is there something like "while" loop in GHC ?? Thanks very much :) ___ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell