In [2]:
public Object f(x){
return x + " ABC";
}
com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, "F");
In [2]:
public Object f(x){
return x + 2;
}
com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, 10d);
Out[2]:
In [3]:
public Object f(x){
return x + 2;
}
com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, 10);
Out[3]:
In [4]:
public Object f(x){
return !x;
}
com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&f, true);
Out[4]:
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]:
In [17]:
public Object d(x, y){
return [x + 2, "abc " + y];
}
com.twosigma.beaker.groovy.widgets.Interactive.interact(this.&d, 10, "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");
In [5]:
import static com.twosigma.beaker.groovy.widgets.Interactive.interact;
public Object f(x){
println "Hello World !!!"
return x
}
interact(this.&f, "s");
In [ ]: