Zulip Chat Archive

Stream: new members

Topic: Repeating until nothing changes


Guilherme Espada (Mar 17 2021 at 17:03):

Is there a way to repeat a tactic until nothing changes in the context? I guess somewhat similar to simp, but with a custom list of tactics

Horatiu Cheval (Mar 17 2021 at 17:08):

Is docs#repeat what you're looking for?
It takes a tactic (or a succession of tactics) as argument

Guilherme Espada (Mar 17 2021 at 17:17):

What I tried before posting was something along the lines of:

repeat{
 try{
  b
 },
 try{
  b
 },
}

However, this doesn't quite work: it seems to run until failure. The tries are needed because if you have multiple possible options, I don't want one fail to prevent the other from running (at an unspecified order). In fact, a tactic may fail in one cycle and work in the next.

Guilherme Espada (Mar 17 2021 at 17:21):

Unless there is a tactic that takes n subtactics and succeeds if any succeed, that would work

Yakov Pechersky (Mar 17 2021 at 17:41):

try { a <|> b <|> c} for the latter idea

Guilherme Espada (Mar 17 2021 at 18:38):

Thanks! Works like a charm!

Scott Morrison (Mar 17 2021 at 22:28):

You might also like src#tactic.chain (but probably too specialized for its application in tactic#tidy for others to use).


Last updated: Dec 20 2023 at 11:08 UTC