drym-org / qi

An embeddable flow-oriented language.
58 stars 12 forks source link

The divert clause in switch should not operate on condition output #54

Closed countvajhula closed 2 years ago

countvajhula commented 2 years ago

Observed behavior: In cases where both a divert clause as well as a => condition output clause are present in a switch expression, the consequent clause in the divert expression operates on the (result of condition flow + original inputs).

Expected behavior: It should operate only on the original inputs, and the result of the condition flow should be forwarded to the consequent flow as is (as the first input).

Example:

(switch (4 -4)
  (% 1> 2>)
  [add1 (=> + sqr)])

This should be 5 + -4, squared = 1, rather than + 4, squared = 16.