Apl2ToDoManipulatingCharactersAlgorithms
This is a sub-page of PhraseBook/ToDo/Apl2Idioms
M←MU[¯1++\B;] ⍝ Replicate MU given boolean start vector.
M←MU[+\B;] ⍝ Replicate MU given boolean start vector.
M←M[⌈\B×⍳⍴B;] ⍝ Replace rows of M given boolean start vector.
V←L/V ⍝ Duplicate items in vector V, L times.
M←LS⌿,[¯.5]V ⍝ Duplicate vector V, LS times.
M←LS⌿,[.5]V ⍝ Duplicate vector V, LS times.
V←(LS×⍴V)⍴V ⍝ Duplicate vector V, LS times.
V←(,L∘.≥⍳⌈/L)\V ⍝ Expand V given length vector L.
V←(V⍳↑1↓C)↑V←(1+V⍳↑C)↓V ⍝ Keep everything from ↑C to ↑1↓C in V.
V←(¯1+V⍳↑1↓C)↑V←(V⍳↑C)↓V ⍝ Keep everything from ↑C to ↑1↓C in V.
V←εV,¨⊂NS⍴S ⍝ Insert NS items S after each item of V.
V←ε(⊂NS⍴S),¨V ⍝ Insert NS items S before each item of V.
V←(V,X)[⍋(⍳⍴V),P] ⍝ Insert X after positions P in V. (⍴P)=⍴X
V←¯1↓(,⌽1,∨\CS≠⌽CM)/,CM,CS ⍝ Matrix to vector at character CS.
V←Y[⍋YεX] ⍝ Move items X to end of Y.
V←ε(-L+1)↑¨V ⍝ Open gaps before each item of V, L wide.
V←ε(L+1)↑¨V ⍝ Open gaps between each item in V, L wide.
V←((~B)-B\L)/V ⍝ Open gaps between points B in V, L wide.
V←εNS↑¨V ⍝ Open NS-1 spaces between each item in V.
M←,['']V ⍝ One column matrix from vector V.
M←,[¯.5]V ⍝ One row matrix from vector V.
M←,[.5]V ⍝ One row matrix from vector V.
M←X,[.5]Y ⍝ Two column matrix from two vectors.
M←X,[1.5]Y ⍝ Two column matrix from two vectors.
M←((⌈.5×⍴V),2)⍴V ⍝ Two column matrix from one vector.
M←X,[¯.5]Y ⍝ Two row matrix from two vectors.
M←X,[.5]Y ⍝ Two row matrix from two vectors.
M←⊃[0]V W X Y ⍝ N column matrix from N vectors.
M←⊃[1]V W X Y ⍝ N column matrix from N vectors.
M←⍉⊃V W X Y ⍝ N column matrix from N vectors.
M←⊃V W X Y ⍝ N row matrix from N vectors.
U←(¯1↓1,V≠1⌽V)/V ⍝ Unique. Drop duplicates from ordered vector.
U←((V⍳V)=⍳⍴V)/V ⍝ Unique. Drop duplicates from vector.
U←(∨⌿<\V∘.=V)/V ⍝ Unique. Drop duplicates from vector.
MU←(¯1↓1,∨/MG≠1⊖MG)⌿MG ⍝ Unique. Drop duplicates from ordered list.
MU←(∨⌿<\M^.=⍉M)⌿M ⍝ Unique. Drop duplicates from list.
APL Wiki