Skip to content

Instantly share code, notes, and snippets.

@onlurking
Last active December 5, 2016 21:38
Show Gist options
  • Save onlurking/bee69dffd388916b48a554bcc14382e2 to your computer and use it in GitHub Desktop.
Save onlurking/bee69dffd388916b48a554bcc14382e2 to your computer and use it in GitHub Desktop.

Grab the nteract

wget https://github.com/nteract/nteract/releases/download/v0.0.15/nteract-0.0.15-linux.tar.gz
tar -xvf "nteract-0.0.15-linux.tar.gz"

Install IPython and Hy

sudo pip3 install hy ipython ipykernel
python3 -m ipykernel install --user

Check if Hy is installed

hy --version

Check if Hy is alright

$ hy
(+ 3 4)

If not, install the bleeding edge version of Hy

sudo pip3 install git+https://github.com/hylang/hy

Grab the Hy Kernel for IPython

pip3 install git+https://github.com/Calysto/calysto_hy.git --user
python3 -m calysto_hy install --user

cd to the extracted nteract folder and launch it with the Hy Kernel

nteract --kernel calysto-hy

Type those examples in the nteract

ENTER to break line, SHIFT + ENTER to eval

(defn hello []
	(print "Goodbye world!"))
(hello)
(defn greetings [arg]
	(print (.format "Hi {}!" arg)))
(greetings "Lambda I/O")
(defn add [x y]
	(+ x y))
(add 10 14)
(import [math])
(print math.pi)
(defn fib [n]
	(if (<= n 2) n
    (+ (fib (- n 1)) (fib (- n 2)))))
(fib 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment