Skip to content

Instantly share code, notes, and snippets.

@zliang-min
Created August 10, 2011 09:49
Show Gist options
  • Save zliang-min/1136477 to your computer and use it in GitHub Desktop.
Save zliang-min/1136477 to your computer and use it in GitHub Desktop.
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