|
From: | Hans-Peter Sorge |
Subject: | Re: Index-of function with structured left-argument |
Date: | Wed, 15 Apr 2020 11:30:52 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
Just from staring at the result, it looks like the result of ⍺⍳⍵ has the same shape as ⍵, and for each item of ⍵ it tells you either the coordinates where it was found in ⍺, or ⍬ if it was not found. (Dunno what it does if ⍺ is a scalar, where ⍬ would be a valid coordinate.)
N.B. in Dyalog APL dyadic iota has been extended to high rank arrays in a completely different way: https://help.dyalog.com/17.1/#Language/Primitive%20Functions/Index%20Of.htm
Jay.
On Tue, 14 Apr 2020 at 09:15, Elias Mårtenson <address@hidden> wrote:
The ISO spec doesn't address what the index-of function should do when the left argument is not a scalar or a one-dimensional array.
GNU APL extends this, but I don't really understand in what way. How am I to interpret the output from this?
(2 2 ⍴ 104 105 106 107) ⍳ (3 4 ⍴ 100+⍳100)
┏→━━━━━━━━━━━━━━━━━━━━━━┓
↓┏⊖┓ ┏⊖┓ ┏⊖┓ ┏⊖┓ ┃
┃┃0┃ ┃0┃ ┃0┃ ┃0┃ ┃
┃┗━┛ ┗━┛ ┗━┛ ┗━┛ ┃
┃┏→━━┓ ┏→━━┓ ┏→━━┓ ┏→━━┓┃
┃┃0 0┃ ┃0 1┃ ┃1 0┃ ┃1 1┃┃
┃┗━━━┛ ┗━━━┛ ┗━━━┛ ┗━━━┛┃
┃┏⊖┓ ┏⊖┓ ┏⊖┓ ┏⊖┓ ┃
┃┃0┃ ┃0┃ ┃0┃ ┃0┃ ┃
┃┗━┛ ┗━┛ ┗━┛ ┗━┛ ┃
┗∊━━━━━━━━━━━━━━━━━━━━━━┛
Regards,Elias
[Prev in Thread] | Current Thread | [Next in Thread] |