basedpl

— Encode

⊤Y encodes nonnegative integers in binary, choosing enough digits for the largest value. The digit axis is first. Zero needs zero digits.

⊤5                ⍝ 1 0 1
⊤2x 5x            ⍝ 3 2⍴0x 1x 1x 0x 0x 1x

B⊤Y represents numbers in bases B. A zero base retains the remaining quotient.

2 2 2 2⊤10         ⍝ 1 0 1 0
0x 60x 60x⊤3661x   ⍝ 1x 1x 1x

Atomic B gives residues. Arrays supply the result axes (⍴B),⍴Y. Exact operands retain exact arithmetic.

9⊤15               ⍝ 6
9⊤⊂15              ⍝ ⊂6
10⊤12 34           ⍝ 2 4

See Decode.