{larg}(fn ##.Depth k)rarg ⍝ Apply fn at depths k.
From Adám Brudzewsky:
Dyadic operator Depth applies the function [fn] at the depths specified by [k].
Right operand [k] behaves like that of the Rank operator in several respects:
- It may have three elements, specifying depths for the monadic, left, and right
cases
- The full form of the levels used is ⌽3⍴⌽k. For example, a 2-element vector p,q
is equivalent to q,p,q .
Negative values are complementary:
fn Depth(-r) rarg ←→ fn Depth((|≡rarg)-r) rarg
This is equivalent to J's L: conjunction:
http://www.jsoftware.com/help/dictionary/dlcapco.htm
http://code.jsoftware.com/wiki/Vocabulary/lcapco
Examples:
⊢a←(1 2)(3 4)(5 6)
┌───┬───┬───┐
│1 2│3 4│5 6│
└───┴───┴───┘
⊢b←(10 20 30)(40 50 60)
┌────────┬────────┐
│10 20 30│40 50 60│
└────────┴────────┘
a(+Depth 1 2)b
┌───────────────────┬───────────────────┬───────────────────┐
│┌────────┬────────┐│┌────────┬────────┐│┌────────┬────────┐│
││11 21 31│42 52 62│││13 23 33│44 54 64│││15 25 35│46 56 66││
│└────────┴────────┘│└────────┴────────┘│└────────┴────────┘│
└───────────────────┴───────────────────┴───────────────────┘
a(+Depth 1 3)b
┌─────────────────────────────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────┐
│┌───────────────────┬───────────────────┐│┌───────────────────┬───────────────────┐│┌───────────────────┬───────────────────┐│
││┌────────┬────────┐│┌────────┬────────┐│││┌────────┬────────┐│┌────────┬────────┐│││┌────────┬────────┐│┌────────┬────────┐││
│││11 21 31│41 51 61│││12 22 32│42 52 62│││││13 23 33│43 53 63│││14 24 34│44 54 64│││││15 25 35│45 55 65│││16 26 36│46 56 66│││
││└────────┴────────┘│└────────┴────────┘│││└────────┴────────┘│└────────┴────────┘│││└────────┴────────┘│└────────┴────────┘││
│└───────────────────┴───────────────────┘│└───────────────────┴───────────────────┘│└───────────────────┴───────────────────┘│
└─────────────────────────────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────┘
a(+Depth ¯1 2)b
┌───────────────────┬───────────────────┬───────────────────┐
│┌────────┬────────┐│┌────────┬────────┐│┌────────┬────────┐│
││11 21 31│42 52 62│││13 23 33│44 54 64│││15 25 35│46 56 66││
│└────────┴────────┘│└────────┴────────┘│└────────┴────────┘│
└───────────────────┴───────────────────┴───────────────────┘
See also: perv saw rows
Back to: contents
Back to: Workspaces