use of org.enumerable.lambda.support.javascript.LambdaJavaScript.FunctionFn2 in project enumerable by hraberg.
the class JavaScriptTest method interactingWithGroovy.
@Test
public void interactingWithGroovy() throws Exception {
ScriptEngine groovy = GroovyTest.getGroovyEngine();
Closure<?> closure = (Closure<?>) groovy.eval("{ n, m -> n * m }");
FunctionFn2 f = toFunction(LambdaGroovy.toFn2(closure));
js.put("f", f);
assertEquals(6.0, js.eval("f(2, 3)"));
}
use of org.enumerable.lambda.support.javascript.LambdaJavaScript.FunctionFn2 in project enumerable by hraberg.
the class JavaScriptTest method interactingWithClojure.
@Test
public void interactingWithClojure() throws Exception {
IFn star = (IFn) ClojureTest.getClojureEngine().eval("*");
FunctionFn2 f = toFunction(LambdaClojure.toFn2(star));
js.put("f", f);
assertEquals(6.0, js.eval("f(2, 3)"));
}
use of org.enumerable.lambda.support.javascript.LambdaJavaScript.FunctionFn2 in project enumerable by hraberg.
the class JavaScriptTest method interactingWithJRuby.
@Test
public void interactingWithJRuby() throws Exception {
ScriptEngine rb = JRubyTest.getJRubyEngine();
RubyProc proc = (RubyProc) rb.eval(":*.to_proc");
FunctionFn2 f = toFunction(LambdaJRuby.toFn2(proc));
js.put("f", f);
assertEquals(6.0, js.eval("f(2, 3)"));
}
Aggregations