使用Ramda使函数pointfree

Jan*_*ans 1 javascript functional-programming pointfree ramda.js

如何使以下功能无点(使用Ramda)?

const prefixAll = R.curry((prefix, list) => R.map(R.concat(prefix), list))
Run Code Online (Sandbox Code Playgroud)

juk*_*ben 7

此外,这应该工作

R.useWith(R.map, [R.concat, R.identity])

(R.identity是否有适当的功能,请参阅@ scott-sauyet的评论.)

见Ramda REPL

PS:但我个人认为,这compose是更好的 - 使用部分应用论证是更多的功能方法.例如R.compose(R.map, R.concat)('a')(['a','b'])

  • @jukben可能会更新答案吗? (2认同)