以无点式书写f x = g x x [英] Writing in pointfree style f x = g x x
问题描述
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, .SII
— ap id id
in Haskell — doesn't type)
这篇关于以无点式书写f x = g x x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!