Created
November 10, 2018 23:17
-
-
Save datatypevoid/d833b3187e631fabefb4ee5f88bd84e8 to your computer and use it in GitHub Desktop.
The bind method returns a new function that is called with a given sequence of arguments preceding any provided when the new function is called. Requires use of lists for arguments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var concat = Fn.new { |l0, l1| | |
l1.each{|item| l0.add(item) } | |
return l0 | |
} | |
var bind = Fn.new { |fn, args0| | |
args0 = args0 || [] | |
return Fn.new { |args1| | |
return fn.call(concat.call(args0, args1)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment