m2ym/optima

Add next-match in addition to "fail"; similarly "require" in addition to "when"

david-a-wheeler opened this issue · 2 comments

In optima the "fail" is too strong; it exits the entire match. In many cases I want to just go to the "next match" instead of failing the entire suite of matches.

I recommend adding a "next-match" that is like fail, but instead just moves on to the next possible matching pattern. Similar, add "require" or similar that is like "when", but if the pattern fails, move on to the next pattern.

m2ym commented

fail should work as you expected. In fact, when is a syntax sugar of guard pattern that will be compiled to a simple if-then-else expression using fail. So, please put a reproducible code.

Never mind, operator error. It does work as expected. Thanks for responding!