Created
August 10, 2011 09:49
-
-
Save zliang-min/1136477 to your computer and use it in GitHub Desktop.
Use scala high functions in JRuby!
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
object HighFunction { | |
def foo(num : Int)(f : Int => Int) = f(num) | |
} |
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
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