如何在Dyalog APL中使用Rank运算符构建自己的每个运算符 [英] How to build own Each operator using Rank operator in Dyalog APL
问题描述
我在这个问题中看到了答案如何使用等级运算符代替APL中的每个运算符如何使用等级⍤
构建自己的每个运算符.
I saw answer in this question How to use rank operator instead of each in APL how to build own Each operator using Rank ⍤
.
单声道f¨x
可以表示为{⊂f⊃⍵}⍤0⊢x
二进位的每个x f¨y
都可以表示为x{⊂(⊃⍺)f(⊃⍵)}⍤0⊢y
Dyadic Each x f¨y
can be represented as x{⊂(⊃⍺)f(⊃⍵)}⍤0⊢y
对此,请回答以下问题:
In terms of this please answer following questions:
- 为什么每个
¨
运算符都可以表示为
Each←{⍺←⊢ ⋄ ⍺ ⍺⍺{×⎕NC'⍺':⊂(⊃⍺)⍺⍺(⊃⍵) ⋄ ⊂⍺⍺⊃⍵}⍤0⊢⍵}
- 上面的表达式中
⍺⍺
的含义
- Why Each
¨
operator can be represented as
Each←{⍺←⊢ ⋄ ⍺ ⍺⍺{×⎕NC'⍺':⊂(⊃⍺)⍺⍺(⊃⍵) ⋄ ⊂⍺⍺⊃⍵}⍤0⊢⍵}
- What means
⍺⍺
in the expression above
预先感谢您的回答.
推荐答案
-
此定义基本上结合了上面列出的单子和双子情况.如果存在
⍺
,×⎕NC'⍺'
将返回1
,否则返回0
,因此它将检查您是单次使用还是双次使用Each
.
This definition basically combines the monadic and dyadic cases which you listed above.
×⎕NC'⍺'
will return1
if⍺
exists and0
otherwise, so it checks if you usedEach
monadically or dyadically.
⍺⍺
是dop Each
的左操作数.它是x f Each y
或f Each y
⍺⍺
is the left operand of the dop Each
. It is the f
in x f Each y
or f Each y
这篇关于如何在Dyalog APL中使用Rank运算符构建自己的每个运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!