Conditional Hyperblocks?

@toontalk posted a discussion of conditional uses of hyperblocks here:

I would like to add "2" to each number in a list that is greater than "3". For example, the list [1 2 3 4 5 6] would become [1 2 3 6 7 8]. Can this be accomplished with conditional hyperblocks?

image

Like this?

Yes, exactly like that. (Thanks!) However, it is not obvious to me why multiplication by two adds two.

Is there a reason that the operations work in this manner?

Because it's a boolean. True is considered as 1 and false 0.

Aha! So if "False" = 0 and "True" = 1, then "1 x 2" = 2. (Much appreciated!)

I go back and forth about whether I like False/True = 0/1. It allows powerful manipulations like this, but it's a sort of unadvertised shift in domain. Sometimes I think we should more fully embrace it, as APL does, with no distinguishing notation for Boolean values, just using 0 and 1. And sometimes I think we should report an error when asked to do arithmetic on Booleans. But this middle ground makes me uncomfortable.

I agree about feeling uncomfortable with silently type-casting Booleans to integers. I even wanted to disable that altogether only to find out that all too many projects already depend on it. I do have a bunch of prototypes for variadic inputs to reporter-IF, so stay tuned for more news about this as we keep thinking about solutions.