feat(library/blast/strategy): add 'orelse' combinator

This commit is contained in:
Leonardo de Moura 2015-12-06 14:12:44 -08:00
parent 732a92de05
commit 39dbbd687b
2 changed files with 11 additions and 0 deletions

View file

@ -93,4 +93,13 @@ optional<expr> strategy_fn::search() {
trace_curr_state_if(r); trace_curr_state_if(r);
} }
} }
strategy operator|(strategy const & s1, strategy const & s2) {
return [=]() {
if (auto r = s1())
return r;
else
return s2();
}
}
}} }}

View file

@ -41,4 +41,6 @@ public:
} }
typedef std::function<optional<expr>()> strategy; typedef std::function<optional<expr>()> strategy;
strategy operator|(strategy const & s1, strategy const & s2);
}} }}