Any kernels with immutable namespaces

31 views
Skip to first unread message

Brian Granger

unread,
Oct 22, 2017, 3:23:03 PM10/22/17
to Project Jupyter
Hi all,

Does anyone know of any Jupyter kernels that have an immutable
namespace that flows between blocks of code? I am looking at how pure
functional languages implement persistent state in Jupyter kernels.

Cheers,

Brian

--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgra...@calpoly.edu and elli...@gmail.com

Doug Blank

unread,
Oct 22, 2017, 6:28:08 PM10/22/17
to Project Jupyter
On Sunday, October 22, 2017 at 3:23:03 PM UTC-4, ellisonbg wrote:
Hi all,

Does anyone know of any Jupyter kernels that have an immutable
namespace that flows between blocks of code? I am looking at how pure
functional languages implement persistent state in Jupyter kernels.

I'm not sure what you mean about "an immutable namespace that flows between blocks of code", but our Calysto Processing kernel has each cell as its own "sketch". Each cell is preprocessed by Processing, compiled by Java (to give good error messages), and then rendered by Javascript. Here is an example notebook:


There is no persistent state between cells, but if I were to try to tackle that, I'd probably do something like beakerX's "auto translate" and use JSON as an intermediary form.

-Doug

Brian Granger

unread,
Oct 22, 2017, 6:39:42 PM10/22/17
to Project Jupyter
Hi Doug!

Most Jupyter kernels that I know of have a persistent namespace that
is mutable - each new block of code is executed in that namespace and
can mutate its state. In python this is something like exec(code,
global_ns, local_ns).

I am looking for any examples where there is persistent state in the
kernel, but that state isn't mutable. The simplest model is a single
immutable namespace that is passed to each new block of code, similar
to the redux pattern:

run_code(old_state, code) -> new_state

But other patterns of immutable state are possible such as reactive
data flows. I am looking for any examples of immutable but persistent
kernel state.
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/b2640b34-4791-4652-ad41-f09e7ccaaab5%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Doug Blank

unread,
Oct 23, 2017, 8:18:47 AM10/23/17
to Project Jupyter
I see. Thanks for the explanation. I don't have an example of that type of implementation, but it does suggest how we could take a kernel like I described (compiled Java cells) and create a kernel that has the appearance of mutable global namespace (by chaining a global state) at least for well-known data types that could be relayed and recreated from cell to cell. 

-Doug
Reply all
Reply to author
Forward
0 new messages