简体   繁体   English

哈斯克尔的咖喱

[英]Curry in Haskell

as you know the foldl function is defined as : 如您所知,foldl函数定义为:

  foldl :: (a -> b -> a ) -> a -> [b] -> a

I want to rewrite the function as an uncurrified function 我想将该函数重写为未使用的函数

I tried this one: 我尝试了这个:

   foldl :: ( (a-> b-> a) , a , [b] ) -> a

Is that correct? 那是对的吗? Maybe it is not important to uncurry but I am gonna write an exam and I am pretty sure this will be one of the tasks to do. 也许通俗易懂并不重要,但我要写考试,而且我很确定这将是要做的任务之一。

Thanks in anticipation ! 谢谢您的期待!

Well, that sure is an uncurried form of foldl . 好吧,那肯定是未经处理的foldl形式。 However, there a more levels on which you can do this – what I'd can the "fully uncurried form" would be 但是,您可以在更高的级别上执行此操作–“完全未经处理的表单”应该是

foldl'' :: ( ((a,b) -> a), a, [b] ) -> a

where not just the function itself but also its function argument is uncurried. 不仅函数本身,而且函数参数都不是未处理的。 OTOH, just calling uncurry on the function would yield merely OTOH,仅在函数上调用uncurry只会产生

foldl''' :: ( (a->b->a), a ) -> [b] -> a

which might thus also be called "uncurried foldl ", though it would certainly not be the desired interpretation in an exam. 这可能因此也被称为“uncurried foldl ”,但它肯定不会在考试所需的解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM