Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Jupyter notebook document examples
Last updated at 11:01 am UTC on 13 August 2018
The two Notebook files (JSON documents) below were made with the standalone electron based application nteract. As Jupyter 'kernel' node.js is used. (thus the scripting engine supports 'JavaScript', https://github.com/n-riesco/ijavascript).

The Jupyter notebook file format could also be used to store Squeak dynabook content (No implementation yet).

https://nbformat.readthedocs.io/en/latest/format_description.html#notebook-file-format

At the highest level, a Jupyter notebook is a dictionary (a JsonObject) with a few keys:




The first example has three text cells.
{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "## Introduction\n",
        "lorem ipsum"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Data structures\n",
        "Sed ut perspiciatis unde omnis iste natus"
      ]
    },
    {
      "cell_type": "markdown",
      "source": [
        "## Control structures\n",
        "Neligat minta strebant plomea."
      ]
    }
  ],

  "metadata": {
    "kernel_info": {
      "name": "node_nteract"
    },
    "language_info": {
      "name": "javascript",
      "version": "8.9.3",
      "mimetype": "application/javascript",
      "file_extension": ".js"
    },
    "kernelspec": {
      "name": "node_nteract",
      "language": "javascript",
      "display_name": "Node.js (nteract)"
    },
    "nteract": {
      "version": "0.11.2"
    }
  },

  "nbformat": 4,

  "nbformat_minor": 4
}




Anoter simple Jupyter notebook file example. It has text and code cells.

{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "(This is a markdown cell)\n",
        "## Arithmetic operations "
      ],
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "// This is a code cell\n",
        "3 + 4"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 8,
          "data": {
            "text/plain": [
              "7"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "## String operations"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "\n'hello'.length"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 9,
          "data": {
            "text/plain": [
              "5"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 9,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "node_nteract"
    },
    "language_info": {
      "name": "javascript",
      "version": "8.9.3",
      "mimetype": "application/javascript",
      "file_extension": ".js"
    },
    "kernelspec": {
      "name": "node_nteract",
      "language": "javascript",
      "display_name": "Node.js (nteract)"
    },
    "nteract": {
      "version": "0.11.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}

JupyterNotebook.png