Show HN: Jevlang: Python with a Smart "If"(github.com) |
Show HN: Jevlang: Python with a Smart "If"(github.com) |
In other words this could be done in plain Python using:
if squiggle_probability(msg, "customer wants refund"):
...
else:
...
The ~ operator does not apply special evaluation rules to its argument expressions, and so can be a function, and that function can also roll in the probability thresholding (another closely-related function can return the raw probability).The Lisp rules of thumb about when to use macros and not to use them apply elsewhere, such as here, but are not well known.