-
Notifications
You must be signed in to change notification settings - Fork 165
Clojure
How to get Clojure working (works on Apple M1 also): Install Leiningen:
cd ~/bin
curl -O https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x lein
Make sure your ~/bin
directory is in your $PATH
.
Create a test project and run tests:
conda create -n clj openjdk
conda activate clj
lein new test1
cd test1
lein test
The last command should print:
$ lein test
lein test test1.core-test
lein test :only test1.core-test/a-test
FAIL in (a-test) (core_test.clj:7)
FIXME, I fail.
expected: (= 0 1)
actual: (not (= 0 1))
Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
Tests failed.
Assume you have done the above (console install)
Navigate somewhere convenient for GitHub repos. I use ~/Documents/GitHub
.
Fetch this repo (you probably alread did, but just in case you didn't):
git clone https://github.com/lcompilers/lpython.wiki.git cd lpython.wiki
Make a conda or python environment. Here's what I did:
pushd ~/Documents/GitHub/lpython.wiki python -m venv clj-venv source ./clj-venv/bin/activate pip install jupyter pip install jupytext pip install jupyterlab
Get clojupyter:
git clone https://github.com/clojupyter/clojupyter.git cd clojupyter git checkout 0.3.6 make install
Run jupyter lab:
jupyter lab .
In the directory navigation tree to the left of the main work pane, open this markdown file as a jupytext notebook (control-click the name "Clojure.md" and follow the picture below):
When Jupyter Lab asks you for a kernel, pick "Clojupyter 0.3.6":
Make sure the following cell works (Shift-Enter with the cursor inside):
(= 42 (* 6 7))