> ~ asks a question about a value and gets back a number or a label, never text. Here it is a probability, and the if fires at >= 0.5.
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.
> ~ asks a question about a value and gets back a number or a label, never text. Here it is a probability, and the if fires at >= 0.5.
In other words this could be done in plain Python using:
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.