In [2]:
public Object f(x){
    return x + " ABC";
}

com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, "F");


Fe ABC

In [2]:
public Object f(x){
    return x + 2;
}

com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, 10d);


Out[2]:
null

In [3]:
public Object f(x){
    return x + 2;
}

com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, 10);


Out[3]:
null

In [4]:
public Object f(x){
    return !x;
}

com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, true);


Out[4]:
null

In [7]:
public Object f(x, y){
    return [x + 2, y + 4];
}

com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, 10, 100);


Out[7]:
null

In [17]:
public Object d(x, y){
    return [x + 2, "abc " + y];
}

com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&d, 10, "0");


[17, abc 0]

In [3]:
import static com.twosigma.beaker.groovy.widgets.Interactive.interact;

class PlotHolder{
    static String text = ""
    static Plot plot = null;
}

public static Object f(x){
    PlotHolder.text = x;
    if(PlotHolder.plot != null){
        PlotHolder.plot.close();
    }
    PlotHolder.plot = new Plot(title: PlotHolder.text)
    display(PlotHolder.plot)
    PlotHolder.text
}

interact(this.&f, "s");


seee

In [5]:
import static com.twosigma.beaker.groovy.widgets.Interactive.interact;

public Object f(x){
    println "Hello World !!!"
    return x
}

interact(this.&f, "s");


s[[

In [ ]: