Ruby Reverse Currying: Is this possible?

有些话、适合烂在心里 提交于 2019-12-05 10:00:43

i think there's no direct way of doing that and what you're doing is a bit dodgy, there probably is better solution to your problem than back-currying

what you could do to achieve desired result is wrap more procs around your procs:

p = proc{|x, y| x - y}
q = proc{|y, x| p[x, y]}
q.curry[1].(4)

in fact you can reorder arguments any way you want but believe me it gets messy very quickly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!