如何在Dyalog APL中使用Rank运算符构建自己的每个运算符 [英] How to build own Each operator using Rank operator in Dyalog APL

查看:135
本文介绍了如何在Dyalog APL中使用Rank运算符构建自己的每个运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个问题中看到了答案如何使用等级运算符代替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:

  1. 为什么每个¨运算符都可以表示为
    Each←{⍺←⊢ ⋄ ⍺ ⍺⍺{×⎕NC'⍺':⊂(⊃⍺)⍺⍺(⊃⍵) ⋄ ⊂⍺⍺⊃⍵}⍤0⊢⍵}
  2. 上面的表达式中⍺⍺的含义
  1. Why Each ¨ operator can be represented as
    Each←{⍺←⊢ ⋄ ⍺ ⍺⍺{×⎕NC'⍺':⊂(⊃⍺)⍺⍺(⊃⍵) ⋄ ⊂⍺⍺⊃⍵}⍤0⊢⍵}
  2. What means ⍺⍺ in the expression above

预先感谢您的回答.

推荐答案

  1. 此定义基本上结合了上面列出的单子和双子情况.如果存在×⎕NC'⍺'将返回1,否则返回0,因此它将检查您是单次使用还是双次使用Each.

  1. This definition basically combines the monadic and dyadic cases which you listed above. ×⎕NC'⍺' will return 1 if exists and 0 otherwise, so it checks if you used Each monadically or dyadically.

⍺⍺是dop Each的左操作数.它是x f Each yf 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆