Most programming languages provide multi-way conditional constructs (like cond in Lisp, guards in Haskell, etc) that allow one to define program behavior according to different conditions. But most of them also implies a default top-down ordering: the next condition is checked only when all preceding conditions are unsatisfied. I wonder if there is any work on conditional constructs that does not follow this convention but rather automatically sort the conditions according to some order. I can foresee how hard it is to get conditions independent. Maybe it is not feasible anyway?


closed as unclear what you're asking by D.W., FrankW, lPlant, Wandering Logic, vonbrand Jul 25 '14 at 19:15

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Can you be more specific about what your question is? It is certainly possible to define a different sort of multi-way conditional construct. If you are asking for a language with that construct, that's probably off-topic -- requests for language recommendations are probably off-topic. (There are also languages with multi-way conditionals where the conditionals must be disjoint.) If you are asking if it is possible to define such a construct, it is certainly possible; many languages will even let you define your own control structure. Can you articulate a more narrowly scoped question? $\endgroup$ – D.W. Jul 16 '14 at 22:56
  • $\begingroup$ Dijkstra's Guarded Programming Language has such an if, one of the true branches is selected at random. $\endgroup$ – vonbrand Jul 25 '14 at 19:15

On what basis you want to sort out conditions conditions are not specific. If they are specific then you may sort out the conditions to not follow top down approach.

And conditions are the only thing that decide which condition next to be tested. That is they handle the flow of your code and one condition is dependent on other.


Not the answer you're looking for? Browse other questions tagged or ask your own question.