rokitna
2021-7-4 09:26:52

You could write a macro you can use at the nearest place that’s actually an expression:

  (cond
    [(eq? 1 2) (printf "two")]
    [else body]))

Then if you have a few definitions like those, your branching code will look like:

  (handling-two
    (handling-three
      (cond
        [(eq? 1 4) (printf "four")]
        [else (printf "else")]))))

The nesting is a bummer, so it does pay to do some more intense macro manipulation here, but this can at least get the job done.