This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-20
Channels
- # beginners (102)
- # boot (23)
- # cljs-dev (1)
- # clojure (52)
- # clojure-canada (7)
- # clojure-korea (2)
- # clojure-poland (1)
- # clojure-russia (35)
- # clojure-spec (39)
- # clojure-uk (5)
- # clojurescript (64)
- # cursive (11)
- # events (1)
- # hoplon (168)
- # lein-figwheel (2)
- # luminus (14)
- # off-topic (47)
- # om (3)
- # om-next (1)
- # onyx (31)
- # quil (4)
- # re-frame (21)
- # spacemacs (1)
- # sql (1)
- # untangled (3)
- # yada (4)
I have a python script that I used to split up some clojure code, I then used the script to divide the code into segments. I want to evaluate the return value at every segment from the terminal.
So I can insert the result of the last expressions return value between every segment.
I want to generate another file that looks like this
(def x (+ 1 2))
=> x
(def y (+ x 4)
=> y
(* y x)
=> 10
Or something like that, I just want to know what the last expression up to each root expression evaluated to, so I can add my little thing (`=> XXX`) that says what the value was at that point.
@micha (mostly just for those following at home). The following seems to work, the first task will not let you evaluate (ns …)
declarations. The second seems to work fine.
(set-env!
:source-paths #{"src/"}
:dependencies
'[[org.clojure/core.logic "0.8.10"]])
(deftask load-code-fails-to-load-namespaces
"Loads and evaluates the string prints to STDOUT"
[c code-to-eval VAL code "The code to be evaluated"]
(-> code-to-eval println))
(deftask load-code
"Loads and evaluates the string prints to STDOUT"
[c code-to-eval VAL str "The code to be evaluated"]
(-> code-to-eval load-string println))
Stephens-MacBook-Pro:reasoned stephen$ boot load-code -c "(ns reasoned.ch1
> (:require
> [clojure.core.logic :as logic :refer [run run* == u# s# fresh conde]])
> (:refer-clojure :exclude [==]))
> ;; > Given
> (defn teacupo [x]
> (conde
> ((== :tea x) s#)
> ((== :cup x) s#)))
> ;; > What is the value of
> (run* [r]
> (teacupo r))
> "
(:tea :cup)