S组合器在Haskell中 [英] S combinator in Haskell
问题描述
S 组合器的类比可以仅使用标准函数在Haskell中表达(没有通过等式来定义它)并且不使用lambda(匿名函数)?我期望它的类型是(a - > b - > c) - > (a - > b) - > a - >例如, K 组合器的类似物就是
const <
。
其实我试图表达函数 \ fx - > fxx
使用标准函数,但不能想到任何标准的非线性函数(这是一个函数多次使用它的参数)。
Applicative
实例。
Can an analog of the S combinator be expressed in Haskell using only standard functions (without defining it by equation) and without using lambda (anonymous function)? I expect it to by of type (a -> b -> c) -> (a -> b) -> a -> c
.
For example, an analog of the K combinator is just const
.
In fact i am trying to express the function \f x -> f x x
using standard functions, but cannot think of any standard non-linear function to start with (that is a function that uses its argument more than once).
s = (<*>)
for the ((->) r)
Applicative
instance.
这篇关于S组合器在Haskell中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!