The Other Inverse of Rho
In APL there is a function rho, ⍴.
5 ⍴ 1 2 3
yields
1 2 3 1 2Rho, ⍴ takes input data on the right. It duplicates the input data until it has output the size described on the left. The output has length 5, built from the input on the right.
⍴ 1 2 3 1 2
yields
5The first inverse of Rho, ⍴
Rho with one argument returns the shape of the input. But rho takes two arguments. I believe rho, ⍴, needs a second inverse, the input data. But not any input data, the shortest possible input data. Lets call the shortest input that could produce the output the “core” of the input. Let us calculate the core of a vector in APL.
a ← 1 2 3 1 2
b ← 5 ⍴ ⊂ a
c ← (1 2 3 4 5) ↑¨ b
d ← 1↑(5 4 3 2 1) ∘.⍴ c
e ← d = ⊂aWe want to calculate the core of 1 2 3 1 2.
Lets look at the values in our program:
a
1 2 3 1 2
Get eric evers’s stories in your inbox
Join Medium for free to get updates from this writer.
b
│1 2 3 1 2│1 2 3 1 2│1 2 3 1 2│1 2 3 1 2│1 2 3 1 2│
c
│1│1 2│1 2 3│1 2 3 1│1 2 3 1 2│
d
│1 1 1 1 1│1 2 1 2 1│1 2 3 1 2│1 2 3 1 1│1 2 3 1 2│
e
│1 0 0 1 0│1 1 0 0 0│1 1 1 1 1│1 1 1 1 0│1 1 1 1 1│
1 2 3 is the third truncation that generates the first core because
1 1 1 1 1 indicates a complete match of the input: 1 2 3 1 2.
1 2 3 1 2 is the fifth truncation that generates the second core
but (1 2 3) is shorter than (1 2 3 1 2) so (1 2 3) is our winner.
So core (1 2 3 1 2) yields (1 2 3), which is the other inverse of rho, ⍴.





