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 approach, I doubt it can be done much better.

m-until is a difficult case for implementation in eager languages. For monads 
whose m-bind calls the continuation only once, it can be rewritten in a 
tail-recursive way, but the required transformation cannot be done 
automatically by the compiler, unfortunately. Perhaps something similar to 
trampoline might work, I didn't explore that direction yet.

Konrad.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to