This release introduces PythonContext
and RContext
allowing Stencil
s to harness the power of the Python and R programming languages. Stencils can now do things like:
<pre data-code="r">
# Create a data.frame containing data on the planets
planets = data.frame(
name = c('Mercury','Venus','Earth','Mars','Jupiter',
'Saturn','Uranus','Neptune'),
diameter = c(0.382,0.949,1,0.532,11.209,9.449,4.007,3.883),
mass = c(0.06,0.82,1,0.11,317.8,95.2,14.6,17.2),
orbital_radius = c(0.47,0.72,1,1.52,5.2,9.54,19.22,30.06),
orbital_period = c(0.24,0.62,1,1.88,11.86,29.46,84.01,164.8),
inclination_to_sun = c(3.38,3.86,7.25,5.65,6.09,5.51,6.48,6.43)
)</pre>
<p data-with="planets">
There are <span data-text="nrow(planets)"></span> planets in the solar system.
<span data-text="name[which.min(orbital_radius)]"></span>
is the closest planet to the sun.
The correlation between the planets` diameter and mass is
<span data-text="cor(diameter,mass)"></span>.
</p>
That sort of functionality is not much fun if you don't have a way of easily interacting with stencils. Towards that end, we have also snuck into this release the Server
class which serves Component
s over both HTTP and Websocket. We are using the WAMP subprotocol for remote procedure calls (and in the future publish-subscribe) over Websockets. All this was made a lot easier by enlisting the help of the excellent WebSocket++ and rapidjson libraries.
We have also done some general code housekeeping. Commit f23970d flattened the directory structure of the cpp
module a lot. There are no longer separate utilities
and tests
subdirectories which makes file navigation and Makefile
configuration easier.
We also did some renaming of array classes. The name Grid
was intended to differentiate static arrays from dynamic arrays. However, when we used the Stencila library in external projects this nomenclature felt a little weird, and probably unnecessary. So, in commit 51f97d7, we have reverted to the single templated Array
class with the template instantiation determining whether an array is static (e.g. Array<int,Year,Month,Region>
) or dynamic (e.g. Array<>
).