Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Dyalog 中有这个简单的 d-fn:
{⍺,≢⍵} ⌸ 'koala'
,它返回:
k 1 o 1 a 2 l 1
我想从结果数组中过滤行,这样(例如,对于过滤器值 = 2),我会得到:
a 2 l 1
一般来说,我想知道如何在 APL 中对二维数组的第 n 列进行操作。
您的预期答案还表明您希望看到带有 l/1 的行 - 对吗?
假设您真的在第二列 = 2 的行之后,您可以使用另一个 dfn 进行过滤:
{(⍵[;2]=2)⌿⍵}{⍺,≢⍵} ⌸ 'koala' a 2
至于问题的一般部分,我希望使用索引来[;2]回答问题,否则我需要更多的话;-)
[;2]