rslt ← lft (fun ##.perv) rgt ⍝ Scalar pervasion.
The function operand is applied between corresponding simple scalars in each
argument.
Technical note:
[perv] is closely related to the dyadic form of operator →saw← (simple-array-
wise). The only difference is that [perv] applies its function operand between
depth-0 arrays and →saw←, between depth-(0 or 1) arrays.
We could parameterize the maximum depth at which the function is applied by
passing it as a right operand:
wwaw←{ ⍝ Function operand applied ⍵⍵-Array-Wise.
⍵⍵≥¯1+|≡⍺ ⍵:⍺ ⍺⍺ ⍵ ⍝ Both shallow enough: apply operand.
⍵⍵≥|≡⍵:∇∘⍵¨⍺ ⍝ ⍵ shallow: traverse ⍺.
⍵⍵≥|≡⍺:⍺∘∇¨⍵ ⍝ ⍺ shallow: traverse ⍵.
⍺ ∇¨⍵ ⍝ Both deep: traverse both.
}
Remember that in Dyalog, vector strands bind tighter than operands. This means
that is may be necessary to separate the right operand from the argument:
aaa (, wwaw 0) bbb ⍝ operand 0 separated from argument bbb.
aaa , wwaw 0 ⌽ bbb ⍝ parentheses unnecessary in this case.
Example:
disp 1(2 3),perv(4 5)6
┌→────────┬─────────┐
│┌→──┬───┐│┌→──┬───┐│
││1 4│1 5│││2 6│3 6││
│└~─→┴~─→┘│└~─→┴~─→┘│
└────────→┴────────→┘
See also: saw rows truth_tables
Back to: contents
Back to: Dyalog APL
Trouble seeing APL font?