gpt4 book ai didi

haskell - 为什么 Haskell 中的无点风格在满分的情况下称为无点? "point-free"这个词是从哪里来的?

转载 作者:行者123 更新时间:2023-12-03 15:14:31 35 4
gpt4 key购买 nike

我目前正在阅读Learn You a Haskell for Great Good我在第 85 页遇到了“point-free style”的概念,如下所示。但是,fn函数是满分 !这让我很困惑。

  • 为什么这种写函数的风格叫“point-free”
    已满 有积分吗?
  • 我应该如何理解这个概念? “无点”在什么意义上?
  • “无点风格”一词起源于哪里?也许从一个
    用空格表示功能组合的语言?

  • PS:到目前为止,这是这本优秀书籍中唯一令人困惑的部分(即到目前为止我读过的前 85 页)。

    enter image description here

    最佳答案

    But pointfree has more points!

    A common misconception is that the 'points' of pointfree style are the (.) operator (function composition, as an ASCII symbol), which uses the same identifier as the decimal point. This is wrong. The term originated in topology, a branch of mathematics which works with spaces composed of points, and functions between those spaces. So a 'points-free' definition of a function is one which does not explicitly mention the points (values) of the space on which the function acts. In Haskell, our 'space' is some type, and 'points' are values. In the declaration f x = x + 1 we define the function f in terms of its action on an arbitrary point x. Contrast this with the points-free version: f = (+ 1) where there is no mention of the value on which the function is acting.



    来自 haskellwiki

    关于haskell - 为什么 Haskell 中的无点风格在满分的情况下称为无点? "point-free"这个词是从哪里来的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22008693/

    35 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com