ThoughtStorms Wiki

One of the goals of CardiganBay (see WhyIsCardiganBayLikeThat?) is as a medium for publishing executable code. The envisaged use-case is for publishing calculations, small computer models, simulations or algorithms.

Although we are still some way from where we want to be, this functionality is already available in embryonic form, as you can see here.

This page has a workspace embedded in it. That is, a space for writing and executing ClojureLanguage code.

However, THIS workspace is demonstrating a new feature where we divide code into private and public sections.

In the textarea below you see the public part of the code. It's intended to give you, the reader, an interface or API to the program. A place where you can define some data or set some parameters and then call an entry function to the model.

The rest of the code is hidden away out of sight. (Though if you ViewSource this page, you'll be able to see it. The goal here is not "obscurity" but to simplify what the reader / user needs to look at to engage with the model.)

So in this example there is some further code behind the scenes to produce a table from a list of numbers, their squares and cubes, and to total each column.

The important point is that this code was written in this page, just as any other writing in this wiki, in the usual edit box. I'm not using special libraries to make this table. I didn't have to use special editing tools. Or external compilers or build chain. There's no cloud platform or CloudBasedIDE behind this site.

It's literally just some embedded Clojure in a page.

And when the page is exported as a flat file, what you get is an "application" embedded in it. Something where there's a little bit of public code containing some parameters, that a user can play with and change. And the rest of application, the fixed model, is hidden.


More on WorkspacePublishingGraphingExample

See also :