{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "id": "PzmKOAh2LZrF" }, "outputs": [], "source": [ "# The Julia bootstrap block\n", "# This should be run for the first time to install Julia kernel, and then refresh this page (e.g., Ctrl-R)\n", "# so that colab will redirect to the installed Julia kernel\n", "# and then doing your own work\n", "\n", "# 1. install latest Julia using jill.py\n", "# tip: one can install specific Julia version using e.g., `jill install 1.7`\n", "!pip install jill && jill install --upstream Official --confirm\n", "# 2. install IJulia kernel\n", "! julia -e 'using Pkg; Pkg.add(\"IJulia\"); using IJulia; installkernel(\"Julia\")'\n", "# 3. hot-fix patch to strip the version suffix of the installed kernel so that this notebook kernelspec is version agnostic\n", "!jupyter kernelspec install $(jupyter kernelspec list | grep julia | tr -s ' ' | cut -d' ' -f3) --replace --name julia" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "erJ7bkEtLrCF", "outputId": "a2e41ca3-18c6-43ae-c245-00f8800c00db" }, "outputs": [ { "data": { "text/plain": [ "25" ] }, "execution_count": 2, "metadata": { "tags": [] }, "output_type": "execute_result" } ], "source": [ "# julia cells\n", "function square(x)\n", " return x*x\n", "end\n", "\n", "square(5)" ] } ], "metadata": { "colab": { "collapsed_sections": [], "name": "julia.ipynb", "provenance": [], "toc_visible": true }, "kernelspec": { "display_name": "Julia", "name": "julia" } }, "nbformat": 4, "nbformat_minor": 2 }