Skip to content

Instantly share code, notes, and snippets.

@torgeir
Last active February 20, 2022 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torgeir/d4c12300c58d97dbd825fad62947e7b0 to your computer and use it in GitHub Desktop.
Save torgeir/d4c12300c58d97dbd825fad62947e7b0 to your computer and use it in GitHub Desktop.
clojure.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "clojure.ipynb",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"kernelspec": {
"display_name": "iclojure",
"name": "iclojure"
},
"language_info": {
"name": "iclojure"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/torgeir/d4c12300c58d97dbd825fad62947e7b0/clojure.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"metadata": {
"id": "z2QwPUbVTVtN"
},
"cell_type": "code",
"source": [
"!wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein; chmod 755 lein; mv lein /usr/local/bin/.\n",
"!git clone https://github.com/HCADatalab/IClojure\n",
"!cd IClojure; make; make install; cd ..\n",
"!jupyter-kernelspec list"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"**After running the first cell, refresh the page with cmd/ctrl + r. You should then be able to run the clojure cells below!**\n",
"\n",
"Why tho? This notebook has its kernelspec set to `iclojure` (see the json https://gist.github.com/torgeir/d4c12300c58d97dbd825fad62947e7b0). This needs to be installed in the current instance before it is available.)"
],
"metadata": {
"id": "SiI6EZQPgK8J"
}
},
{
"cell_type": "code",
"source": [
"(+ 1 2)"
],
"metadata": {
"id": "RBWj9pJOe20b"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"/cp {:paths [\"resources\" \"src\"]\n",
" :deps {org.clojure/clojure {:mvn/version \"RELEASE\"}\n",
" kixi/stats {:mvn/version \"0.5.4\"}\n",
" }}"
],
"metadata": {
"id": "gSx1hRw7qt2i"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"(use '[kixi.stats.core :as k :only (standard-deviation)])"
],
"metadata": {
"id": "yFVIKTz6l0op"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"(->> [{:x 2} {:x 4} {:x 4} {:x 4} {:x 5} {:x 5} {:x 5} {:x 7} {:x 9}]\n",
" (transduce (map :x) k/standard-deviation))"
],
"metadata": {
"id": "Ngh0al3rmEzE"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment