Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用柯里化R?
R
一种可能性是具有特殊功能(它可以被认为是对这里paste的跟进),例如(在不正确的代码中):
paste
'%+%' <- (sep)function(x,y) paste(x,y,sep=sep) "a"%+%("")"b"%+%("_")"c" #gives "ab_c"
什么是可能的实现R?
PS:这paste只是一个例子,我很好奇R......
R 中函数式编程的标准位置现在是functional库,这个库替代了这里ROxigen讨论的库:
functional
ROxigen
library(functional) newfunc <- Curry(oldfunc,x=5)
可以在R中进行curry,在ROxygen包中有定义。请参阅此处的讨论