Function mux

Source
pub fn mux<A, C, TH, EL>(vm: &mut RoundVM, cond: C, th: TH, el: EL) -> A
where C: Fn(&mut RoundVM) -> bool, TH: Fn(&mut RoundVM) -> A, EL: Fn(&mut RoundVM) -> A,
Expand description

Evaluates the given expressions and returns the result based on the given condition. N.B both th and el will be evaluated, thus they will both affect the [Path], but only the result of one of them will be returned.

§Arguments

  • vm - The current VM.
  • cond - The condition to evaluate, which should return a boolean.
  • th - The then-expression to evaluate.
  • el - The else-expression to evaluate.

§Returns

The result of the evaluation of the then-expression if the condition is true, else the result of the evaluation of the else-expression alongside the RoundVM.