Create a gist now

Instantly share code, notes, and snippets.

Use scala high functions in JRuby!
object HighFunction {
def foo(num : Int)(f : Int => Int) = f(num)
}
require 'java'
import 'HighFunction' # make sure HighFunction.class & HighFunction$.class are in your path
HighFunction.foo(10) { |n| n * 2 } #=> 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment