In [ ]:
%%groovy
println("stdout works")
f = {it + " work"}
f("results")
In [ ]:
%%groovy
%classpath add mvn com.github.fommil.netlib core 1.1.2
new org.netlib.blas.Daxpy()
In [ ]:
%%groovy
[a:"tables", b:"work"]
In [ ]:
%%groovy
"errors work"/1
In [ ]:
%%groovy
HTML("<h1>HTML works</h1>")
In [ ]:
%%groovy
def p = new Plot(title : 'Plots Work', xLabel: 'Horizontal', yLabel: 'Vertical');
p << new Line(x: [0, 1, 2, 3, 4, 5], y: [0, 1, 6, 5, 2, 8])
In [ ]:
%%java
import java.util.List;
import com.twosigma.beakerx.chart.xychart.Plot;
import java.util.Arrays;
Plot p = new Plot();
p.setTitle("Java Works");
p.setXLabel("Horizontal");
p.setYLabel("Vertical");
Bars b = new Bars();
List<Object> x = Arrays.asList(0, 1, 2, 3, 4, 5);
List<Number> y = Arrays.asList(0, 1, 6, 5, 2, 8);
Line line = new Line();
line.setX(x);
line.setY(y);
p.add(line);
return p;
In [ ]:
%%scala
val plot = new Plot { title = "Scala Works"; xLabel="Horizontal"; yLabel="Vertical" }
val line = new Line {x = Seq(0, 1, 2, 3, 4, 5); y = Seq(0, 1, 6, 5, 2, 8)}
plot.add(line)
In [ ]:
%%kotlin
val x: MutableList<Any> = mutableListOf(0, 1, 2, 3, 4, 5)
val y: MutableList<Number> = mutableListOf(0, 1, 6, 5, 2, 8)
val line = Line()
line.setX(x)
line.setY(y)
val plot = Plot()
plot.setTitle("Kotlin Works")
plot.setXLabel("Horizontal")
plot.setYLabel("Vertical")
plot.add(line)
plot
In [ ]:
%%clojure
(import '[com.twosigma.beakerx.chart.xychart Plot]
'[com.twosigma.beakerx.chart.xychart.plotitem Line])
(doto (Plot.)
(.setTitle "Clojure Works")
(.setXLabel "Horizontal")
(.setYLabel "Vertical")
(.add (doto (Line.)
(.setX [0, 1, 2, 3, 4, 5])
(.setY [0, 1, 6, 5, 2, 8]))))
In [ ]:
%%sql
%defaultDatasource jdbc:h2:mem:db
DROP TABLE IF EXISTS cities;
CREATE TABLE cities(
zip_code varchar(5),
latitude float,
longitude float,
city varchar(100),
state varchar(2),
county varchar(100),
PRIMARY KEY (zip_code),
) AS SELECT
zip_code,
latitude,
longitude,
city,
state,
county
FROM CSVREAD('../../../doc/resources/data/UScity.csv')
In [ ]:
%%sql
SELECT * FROM cities WHERE state = 'NY'
In [ ]:
%%groovy
while(true) {
Thread.sleep(100)
}
In [ ]: