Zombie Zen

An Ivy Notebook

By Roxy Light

I hacked out a Jupyter kernel for Rob Pike’s ivy language, an APL-like desk calculator. This allows using Ivy expressions inside a Jupyter notebook and inside Visual Studio Code’s notebooks feature. It’s got rough edges, but it’s good enough for me to quickly do calculations without leaving Visual Studio Code.

Screenshot of a Jupyter notebook with the Ivy demo.

Screenshot of a Jupyter notebook with the Ivy demo.

The source is up on GitHub. (Installation is a little DIY if you’re not using Nix, but it should go build if you have libzmq installed locally.)

Some observations:

  • Understanding and implementing the Jupyter kernel protocol took some effort. It’s not terribly hard, but the docs assume a familiarity with notebook interactions.
  • The protocol uses ZeroMQ, which I had not used before, and doesn’t have great support for Go. I originally tried using github.com/zeromq/goczmq, but it didn’t lend itself to interrupting reads with context.Context. So instead, I wrote a small wrapper around libzmq. I’m not 100% satisfied with the sleep/poll loops, but it works.
  • I continue to be pleased with using Nix as a distribution mechanism. It allows me to use whatever libraries or tools I want and I can drop the resulting programs into my dot files with ease. This is especially handy since this project needed CGo.
Posted at
Permalink