Valences

Valences ๐”ฝโŠ˜๐”พ ๐•ฉ ๐”ฝ ๐•ฉ ๐•จ ๐”ฝโŠ˜๐”พ ๐•ฉ ๐”พ ๐•จ ๐•ฉ

Every BQN function can be called with one or two arguments, possibly doing completely different things in each case. The Valences (โŠ˜) 2-modifier grafts together a one-argument function ๐”ฝ and a two-argument function ๐”พ, with the resulting function calling one or the other as appropriate. It's the tacit equivalent of a block function with two bodies. So the function {รท๐•ฉ ; ๐•ฉ-๐•จ} can also be written รทโŠ˜(-หœ). A full definition of Valences as a block is {๐”ฝ๐•ฉ;๐•จ๐”พ๐•ฉ}.

โ†—๏ธ
      -โŠ˜+ 6  # - side
ยฏ6

    3 -โŠ˜+ 2  # + side
5

Valences provides one way to check whether ๐•จ is present in a block function. The expression ๐•จ0โŠ˜1๐•ฉ always ignores the values of the arguments, resulting in 0 if ๐•จ isn't given and 1 if it is (if you want 1 or 2, then โ‰ ๐•จโ‹ˆ๐•ฉ is shorter, but I'm not sure if I like it).

โ†—๏ธ
        {๐•จ0โŠ˜1๐•ฉ} 'x'
0

    'w' {๐•จ0โŠ˜1๐•ฉ} 'x'
1