Skip to content

Instantly share code, notes, and snippets.

@datatypevoid
Created November 10, 2018 23:17
Show Gist options
  • Save datatypevoid/d833b3187e631fabefb4ee5f88bd84e8 to your computer and use it in GitHub Desktop.
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.
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