什么构成“兼容形状”? J 动词的数组参数?
我正在学习(并且让我大吃一惊)J,并阅读学习J。我注意到我学习的许多(所有?)动词的论点都非常灵活。我可以执行传统的 4 - 2
,也可以将其与列表一起使用,例如 4 5 - 3 4
,甚至可以执行 3 4 5 - 1< /code> 似乎将运算符的右侧“提升”为数组,即使我只是给了它一个标量。
我认为后一种行为已被 ch 中的这一行所涵盖。上述文字2:
因此, = 的两个参数必须具有相同的形状,(或者在 至少,如 Y=2 的示例,兼容形状)。否则一个 错误结果。
事实上,3 4 5 - 2 3
是一个错误。 “兼容形状”的技术定义是什么?它是像“相同的形状或标量”一样简单,还是还有更多内容?
I'm in the process of learning (and having my mind blown by) J, and reading Learning J. I have noticed that many (all?) verbs I've been learning are pretty flexible with their arguments. I can do the traditional 4 - 2
, or I can use it with lists e.g. 4 5 - 3 4
, and can even do 3 4 5 - 1
which seems to "promote" the right-hand side of the operator to an array even though I just gave it a scalar.
I assume the latter behavior is covered by this line, from ch. 2 of the aforementioned text:
Consequently, the two arguments of = must have the same shapes, (or at
least, as in the example of Y=2, compatible shapes). Otherwise an
error results.
Indeed, 3 4 5 - 2 3
is an error. What is the technical definition of a "compatible shape"? Is it as simple as "same shape or a scalar", or is there more to it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从词典页面 B.动词:
因此以下内容都将起作用
有关框架的正式定义请参阅词典页面A.名词
我推荐针对 C 程序员的 J 的这一部分< /a> 作为对这些概念的彻底覆盖。
From the Dictionary page B. Verbs :
So the following will all work
For a formal definition of frame see the Dictionary page A. Nouns
I'd recommend this section of J for C programmers as a thorough coverage of these concepts.