by moonchild · 4y ago · 0 comments
Power is for sequential iteration. You may be thinking of rank (⍤).
]boxing on
Was OFF
(⊂⍣5) 2 3 4
┌─────────────┐
│┌───────────┐│
││┌─────────┐││
│││┌───────┐│││
││││┌─────┐││││
│││││2 3 4│││││
││││└─────┘││││
│││└───────┘│││
││└─────────┘││
│└───────────┘│
└─────────────┘
(On GNU APL, it looks like the relevant formulation is ']boxing 3' rather than ']boxing on'; this simply affects the display of nested arrays.)(You can do f⍣g⍤n, but then, again, that is rank doing the work of parallelization. And, performance considerations aside, I am no longer so convinced of the aesthetic utility of ⍤ as I once was. Wrt performance, when targeting CPUs, where branches are not so cheap, it might be worthwhile to design an f which can tolerate being called overly many times. Then give y an extraneous trailing axis the same size as a simd lane and do (f⍣g⍤1) y. That permits the whole computation to be vectorised, though it is also somewhat brittle.)
(Note ≡ is not the same as =. 1 1 1 ←→ 1 2 3 = 1 2 3, but 1 ←→ 1 2 3 ≡ 1 2 3. f⍣≡ is an idiom. f⍣= is meaningless except at rank 0, where is behaves the same as f⍣≡.)