Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2010-05-04 Thread Konrad Hinsen
On 04.05.2010, at 05:39, David Barksdale wrote: > I tried to define "n-times" using the pattern of none-or-more and came > to the realization that the state-m-until does not handle a parser > that fails. So here is m-until for the parser monad and my n-times > using it: That looks like a good app

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2010-05-03 Thread David Barksdale
On May 2, 10:59 pm, David Barksdale wrote: > On Dec 28 2009, 7:03 am, Konrad Hinsen > wrote: > > > > > On 27.12.2009, at 01:47, samppi wrote: > > > > creates a new rule that repeats a given subrule. The problem with rep+ > > > right now is that it increases the stack for every token it consumes

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2010-05-03 Thread David Barksdale
On Dec 28 2009, 7:03 am, Konrad Hinsen wrote: > On 27.12.2009, at 01:47, samppi wrote: > > > creates a new rule that repeats a given subrule. The problem with rep+ > > right now is that it increases the stack for every token it consumes, > > which overflows the stack with large amounts of tokens.

Re: Monad problem: rewriting a recursive domonad call to not blow up the stack

2009-12-28 Thread Konrad Hinsen
On 27.12.2009, at 01:47, samppi wrote: > creates a new rule that repeats a given subrule. The problem with rep+ > right now is that it increases the stack for every token it consumes, > which overflows the stack with large amounts of tokens. > > Is there, then, a way to rewrite rep+ so that it doe

Monad problem: rewriting a recursive domonad call to not blow up the stack

2009-12-26 Thread samppi
For those of you who are familiar with Clojure monads, please consider the following problem. In the REPL log below, I define a monad parser- m whose monadic values are parser functions (in fact, it's the same as state-m, only with nil indicating failure) and a function rep+ that creates a new rule