Join the discussion
Write your take first — we'll ask for email only when you're ready to publish.
- Hacker News
- > ~ 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).if squiggle_probability(msg, "customer wants refund"): ... else: ...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.
by kazinator