feat(library/blast/strategy): add 'orelse' combinator
This commit is contained in:
parent
732a92de05
commit
39dbbd687b
2 changed files with 11 additions and 0 deletions
|
@ -93,4 +93,13 @@ optional<expr> strategy_fn::search() {
|
|||
trace_curr_state_if(r);
|
||||
}
|
||||
}
|
||||
|
||||
strategy operator|(strategy const & s1, strategy const & s2) {
|
||||
return [=]() {
|
||||
if (auto r = s1())
|
||||
return r;
|
||||
else
|
||||
return s2();
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -41,4 +41,6 @@ public:
|
|||
}
|
||||
|
||||
typedef std::function<optional<expr>()> strategy;
|
||||
|
||||
strategy operator|(strategy const & s1, strategy const & s2);
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue