Another option to consider: Treat the problem as a `reduce` on the sequence of adjustments where the processing of each adjustment depends on the user input and "cancel" makes the processing return (reduced nil) to halt the reduction. That will stop automatically when the sequence of adjustments ends or the processing function evaluates to a reduced value.
Sean On Mar 1, 2015, at 2:52 AM, Cecil Westerhof <cldwester...@gmail.com> wrote: > 2015-03-01 11:33 GMT+01:00 Colin Yates <colin.ya...@gmail.com > <mailto:colin.ya...@gmail.com>>: > I would replace it with loop/recur or a while, with both checking a > termination flag (probably an atom) which is set by the user. > > I was just going to post that I was going to use a loop. You beat me to it. > ;-) > Probably being busy for to long, because I should have thought about that. :-( > Well I keep updating my Clojure skills. :-) > > No need for a flag (in this case): the user is shown an adjustment. He can > choose yes, no, or cancel. Cancel is the break out of the loop. With no the > adjustment is not done and the next one is shown. With yes the adjustment is > done and the next one is shown. > > An alternative approach would be core.async with a stop channel and then use > alt! to check them both simultaneously. > > Something to dive into later. (Just as some other things that came up in my > avalanche of questions of lately.) > > I must say I like Clojure. It is a bit different and I need to get used to > it, but it looks like when I am proficient in it, my productivity will be > quit a bit higher. > > > On 1 Mar 2015 10:30, "Cecil Westerhof" <cldwester...@gmail.com > <mailto:cldwester...@gmail.com>> wrote: > I have a program where I change a lot of records based on id's in a sequence. > It is a manual process, so I want to give the user an option to terminate the > sequence. What would be the correct way to stop (for example) a doseq? > > -- > Cecil Westerhof -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.