术语“monadic”是指“monadic”吗? in J 与其 Haskell 的使用有什么关系?

发布于 2024-12-26 13:05:31 字数 154 浏览 4 评论 0原文

(抱歉,我很愚蠢,没有受过教育,所以这可能是一个荒谬的问题。)

我刚刚开始研究 J,他们使用术语“一元”和“二元”来表示(对我来说)似乎是一元和二元的运营商。为什么要这样做,它与我在其他地方听到的术语(Haskell)有什么关系?我的猜测是它们是不相关的同音异义词,但我不确定。

(Sorry, I'm stupid and uneducated, so this is probably a ridiculous question.)

I just started looking at J, and they use the terms "monadic" and "dyadic" for what seems (to me) to be unary and binary operators. Why is this done, and how does it relate to the other place I've heard the term (Haskell)? My guess is they are unrelated homonyms but I'm not sure.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一梦等七年七年为一梦 2025-01-02 13:05:31

除了都源自希腊语词根“一”之外,它们没有任何关系。一元和二元确实是一元和二元函数的术语。具体来说,它们是希腊语衍生的等价物——使用-adic而不是-ary。考虑一下“triad”这个词,它也是源自希腊语。

Haskell 使用的 Monad 具有词源不清楚,但可能源自“monoid”。

不过,我鼓励坚持使用 Haskell 中源自拉丁语的“n 元”术语。从技术上讲,由于柯里化,Haskell 中的所有函数都有一个参数,因此使用源自希腊语的形式可能会产生任意数量的混乱。

They're unrelated except by both deriving from the Greek root for "one". Monadic and dyadic are indeed terms for unary and binary functions. Specifically, they're the Greek-derived equivalents--using -adic instead of -ary. Consider the word "triad", which is also Greek-derived.

Monad in the sense Haskell uses it has an unclear etymology but probably derives from "monoid".

I would encourage sticking with the Latin-derived "n-ary" terms in Haskell, though. All functions in Haskell technically have one argument because of currying, so using the Greek-derived form could produce arbitrary amounts of confusion.

真心难拥有 2025-01-02 13:05:31

他们是不相关的; CA McCann 指出了两者的词源。

无论如何,Haskell 的使用当然来自范畴论,并且被认为是与其他含义无关的独立创造。单子。

事实上,J 意义上的“monadic”可以追溯到 APL,它比 Haskell 早了四分之一个世纪!我认为它也可能早于范畴论该术语的使用。

They're unrelated; C. A. McCann points out the etymologies of both.

In any case, the Haskell use, of course, comes from category theory, and is thought to be an independent coining unrelated to the other senses of monad.

Indeed, the J sense of "monadic" dates back to APL, which predates Haskell by a quarter of a century! I think it might predate the category theory usage of the term, too.

雨巷深深 2025-01-02 13:05:31

Adicity(或adinity)是arity,使用希腊数字根而不是拉丁语:

  • niladic/medadic = nullary

  • monadic = unary

  • dyadic =二元

  • 三元 = 三元

  • 三元

  • ...

的各种含义哲学、宗教、生物学、范畴论和函数式编程中的单子都是从其“单元”的字面含义中单独衍生出来的。 Haskell 术语可能源自monoid,一种相当于加法单子的代数结构。

Adicity (or adinity) is an alternative to arity, using Greek numeral roots instead of Latin:

  • niladic/medadic = nullary

  • monadic = unary

  • dyadic = binary

  • triadic = ternary

  • tetradic = quaternary

The various meanings of monad in philosophy, religion, biology, category theory, and functional programming are all derived separately, from its literal denotation of a “unit”. The Haskell term is probably derived from monoid, an algebraic structure equivalent to an additive monad.

痴情换悲伤 2025-01-02 13:05:31

不,J 的使用与 Haskell 术语无关。一元函数和二元函数分别是一个参数和两个参数的函数。

J 术语起源于 APL,它比 Haskell 更老一些,但我很少看到它们在 APL 家族之外这样使用。

在非 APL 上下文中使用这些术语的一个示例来自《干净代码< /a>,在关于函数的章节中讨论了尼拉函数、一元函数和二元函数。

No, the J use has nothing to do with the Haskell term. Monadic and dyadic functions are functions of one and two arguments, respectively.

The J terms originate from APL, which is a bit older than Haskell, but I have rarely seen them used like this outside of the APL family.

One example of the use of these terms in a non-APL context is from the book Clean Code, which in the chapter about functions talks about niladic, monadic and dyadic functions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文