In standard FORTRAN or Fortran, the operands of a boolean expression can be evaluated in any order. Incomplete evaluation is permitted, but implementation defined.
This allows optimisation of boolean expressions that would not be permitted if strict Left-To-Right ordering was enforced. Expressions which require strict ordering must be decomposed into seperate conditionals, or implementation-dependent assumptions can be made.
Since decomposition is used to enforce ordering, it follows that seperate IF statements can not always be optimised into a single expression. However, short-circuit evaluation is explicit with decomposition, and this is never worse than languages which enforce strict left-to-right ordering to allow lazy evaluation.
Languages wich are derived from FORTRAN (Fortran, BASIC, VBn), and languages which were designed to achieve FORTRAN-like efficiency (Pascal, Ada) initially followed the FORTRAN example of allowing out-of-order evaluation.
if
is just a function that calls other functions (called thunks as fair I remember - from a Coursera' programming course).(if (< a b) (print "foo") (print "baz"))
-if
will just call(print "foo")
or(print "baz")
. In a Factor you would write something like:[ "foo" print ] [ "baz" print ] if
. You just need a programming language with ability to create and pass function as an argument to a another function. – Amphetamine