以无点式书写f x = g x x [英] Writing in pointfree style f x = g x x

查看:83
本文介绍了以无点式书写f x = g x x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Haskell。我很抱歉提出一个非常基本的问题,但我似乎找不到答案。我有一个函数f定义为:

  fx = gxx 

其中g是2个参数的已定义函数。我如何编写这种无点式样?
编辑:不使用lambda表达式。
$ b

谢谢

f 可以用 Control.Monad.join

  f =连接g 

在函数monad上加入是构造无点表达式时使用的基元之一,因为它不能在无点式样本身中定义(它的 SKI微积分等值, SII - ap id id 在Haskell中 - 没有输入)


I am learning Haskell. I'm sorry for asking a very basic question but I cant seem to find the answer. I have a function f defined by :

f x = g x x

where g is an already defined function of 2 arguments. How do I write this pointfree style? Edit : without using a lambda expression.

Thanks

解决方案

f can be written with Control.Monad.join:

f = join g

join on the function monad is one of the primitives used when constructing point-free expressions, as it cannot be defined in a point-free style itself (its SKI calculus equivalent, SIIap id id in Haskell — doesn't type).

这篇关于以无点式书写f x = g x x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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