⊤ Encode r←[x]⊤y
If x is not provided, it defaults to the scalar 2.
If x is non-scalar, operates on vectors of x and scalars of y, the following recursive procedure is performed:
- let
bbe⊇xandbsbe¯1↓x - let
rembeb=0⍰y⍠b|yanddivbeb=0⍰0⍠⌊y÷b risrem⍪⍨bs⊤div
If x is scalar, operates on vectors of y, x must have magnitude greater than 1 and the following recursive procedure is performed:
- if
y=0, thenris⟨⟩ - let
rembex|yanddivbe⌊y÷x - let
rem1bex|divanddiv1be⌊div÷x - if
rem=rem1anddiv=div1thenrisy - otherwise
risrem⍪⍨x⊤div
with the difference that encoding 0 returns ⟨0⟩ instead of ⟨⟩.
If the results of each vector of y are of different sizes, they are padded with 0s.
Supports the tolerance extra argument for the comparisons; supports the backward extra argument which reverses the results.