/sicp

Sicp in clojure, with devcards

Primary LanguageClojure

Sicp code in ClojureScript, with devcards

Learning ClojureScript by rewriting (some) SICP code in it.

The objective is to write idiomatic ClojureScript code as much as possible but still retain the SICP spirit of the code.

Devcards because why not? It's totally awesome ;)

Learn some Reagent by the way, and learn writing some tests in ClojureScript.

Run

You need leiningen to try it out. Just brew install leiningen if you're on a Mac, then run lein figwheel, wait and open http://localhost:3449/cards.html in your browser, the rest should be pretty self-explanatory.

Hack

This stuff works really well with vim-fireplace, I just put:

{:user {:repl-options {
                       :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}

        :dependencies [[figwheel-sidecar "0.5.0-2"]
                       [cider/cider-nrepl "0.10.0"]
                       [com.cemerick/piggieback "0.2.1"]
                       [org.clojure/tools.nrepl "0.2.12"]]

        :plugins [[lein-ancient "0.6.8"]]

        :figwheel {:nrepl-port       7888
                   :nrepl-middleware ["cider.nrepl/cider-middleware"
                                      "cemerick.piggieback/wrap-cljs-repl"]}}}

in my ~/.lein/profiles.clj and then I can evaluate stuff directly from Vim.

Connect to the nRepl with:

:Connect nrepl://localhost:7888

and then execute:

Piggieback! (do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/cljs-repl))

in fireplace 'quasi-repl'.

I put this in my .vimrc as a command:

command! Figwheel :Piggieback! (do (require 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/cljs-repl))

The ClojureScript tooling is very chaotic ATM, if vim-fireplace does not play well with eval (cpp) try this fork, works nice for me.

License

em....whatever...