Last active
May 15, 2023 01:28
-
-
Save bhb/2686b023d074ac052dbc21f12f324f18 to your computer and use it in GitHub Desktop.
Revisions
-
bhb revised this gist
Jan 15, 2022 . 3 changed files with 13 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,18 +3,18 @@ A beginner-friendly REPL that combines * [rebel-readline](https://github.com/bhauman/rebel-readline) * [Expound](https://github.com/bhb/expound) * [Speculative](https://github.com/borkdude/speculative) ## Usage JVM 8: `clojure -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "d532662414376900c13bed9c920181651e1efeff"}}}' -X friendly/run` JVM 9 or newer: `clojure -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "d532662414376900c13bed9c920181651e1efeff"}}}' -X friendly/run` ## Credits This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ {:paths ["."] :deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"} expound/expound {:mvn/version "0.9.0"} org.clojure/core.specs.alpha {:mvn/version "0.2.62"} speculative/speculative {:git/url "https://github.com/borkdude/speculative.git" :sha "4e773794a4065a84bdadd997516e52c76ab51b1f"}}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,13 @@ (ns friendly (:require [rebel-readline.clojure.main] [expound.alpha :as expound] [clojure.spec.alpha :as s] [clojure.stacktrace] [clojure.main] ;; for specs [speculative.instrument :as speculative])) (expound/defmsg :speculative.specs/ifn "should be a function (or a value that can be *treated* like a function e.g. a set or keyword)") (def printer (expound/custom-printer {:print-specs? false :show-valid-values? true @@ -44,8 +42,8 @@ "[trace missing]"))))))))) (speculative/instrument) (set! s/*explain-out* printer) (defn run [_opts] (rebel-readline.clojure.main/repl :caught repl-caught)) -
bhb revised this gist
Jan 15, 2022 . No changes.There are no files selected for viewing
-
bhb revised this gist
Jan 15, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,11 +10,11 @@ A beginner-friendly REPL that combines JVM 8: `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "d532662414376900c13bed9c920181651e1efeff"}}}' -M -m friendly` JVM 9 or newer: `clj -J --add-modules=java.xml.bind -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "d532662414376900c13bed9c920181651e1efeff"}}}' -M -m friendly` ## Credits -
bhb revised this gist
Jan 15, 2022 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ {:paths ["."] :deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"} venantius/pyro {:mvn/version "0.1.2"} expound {:mvn/version "0.9.0"} org.clojure/core.specs.alpha {:mvn/version "0.2.62"} speculative {:git/url "https://github.com/borkdude/speculative.git" :sha "4e773794a4065a84bdadd997516e52c76ab51b1f"}}} -
bhb revised this gist
Jan 15, 2022 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,11 @@ [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st] [clojure.stacktrace] [clojure.main] ;; for specs [speculative.core :as speculative])) (expound/defmsg ::speculative/ifn "should be a function (or a value that can be *treated* like a function e.g. a set or keyword)") (def printer (expound/custom-printer {:print-specs? false :show-valid-values? true -
bhb revised this gist
Jan 15, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ {:paths ["."] :deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"} venantius/pyro {:mvn/version "0.1.2"} expound {:mvn/version "0.9.0"}}} -
bhb revised this gist
Sep 7, 2018 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,14 @@ A beginner-friendly REPL that combines ## Usage JVM 8: `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "418bf66fd96851cc55398b55d5a8aff65692f565"}}}' -m friendly` JVM 9 or newer: `clj -J --add-modules=java.xml.bind -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "418bf66fd96851cc55398b55d5a8aff65692f565"}}}' -m friendly` ## Credits Inspired by https://github.com/slipset/friendly -
bhb revised this gist
Jul 9, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ A beginner-friendly REPL that combines ## Usage `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "418bf66fd96851cc55398b55d5a8aff65692f565"}}}' -m friendly` ## Credits -
bhb revised this gist
Jul 9, 2018 . 1 changed file with 8 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,13 +17,19 @@ el (when-not (zero? (count tr)) (aget tr 0)) ex-m (Throwable->map ex)] (binding [*out* *err*] (cond ;; If the output is a clojure spec issue... (::s/problems (:data ex-m)) ;; print expound output (do (println (str (re-find #"Call to .* did not conform to spec\:" (.getMessage ex)) "\n" (with-out-str (printer (:data ex-m)))))) (instance? clojure.lang.LispReader$ReaderException e) (println (:cause (Throwable->map e))) :else ;; otherwise print exception (println (str (if (instance? clojure.lang.Compiler$CompilerException ex) (str -
bhb revised this gist
Jul 8, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ A beginner-friendly REPL that combines ## Usage `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "a6a6727f68d52d9024079bdd93fab87222993ae5"}}}' -m friendly` ## Credits -
bhb revised this gist
Jul 8, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ A beginner-friendly REPL that combines ## Usage `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "2686b023d074ac052dbc21f12f324f18"}}}' -m friendly` ## Credits -
bhb revised this gist
Jul 8, 2018 . 1 changed file with 12 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,17 @@ # Friendly A beginner-friendly REPL that combines * [rebel-readline](https://github.com/bhauman/rebel-readline) * [Pyro](https://github.com/venantius/pyro) * [Expound](https://github.com/bhb/expound) ## Usage `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "c6b0b7cb0a30e2edbf7050c0119ef038cf0f0ac2"}}}' -m friendly` ## Credits Inspired by https://github.com/slipset/friendly I learned the technique of loading code via a gist from https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202 -
bhb revised this gist
Jul 8, 2018 . 3 changed files with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ Inspired by https://github.com/slipset/friendly I learned the technique of loading code via a gist from https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ {:paths ["."] :deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"} venantius/pyro {:mvn/version "0.1.2"} expound {:mvn/version "0.7.1"}}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ (ns friendly (:require [pyro.printer :as pyro] [rebel-readline.clojure.main] [expound.alpha :as expound] [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st] @@ -37,4 +38,4 @@ (set! s/*explain-out* printer) (st/instrument) (pyro/swap-stacktrace-engine!) (rebel-readline.clojure.main/repl :caught repl-caught)) -
bhb revised this gist
Jul 6, 2018 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ # Usage `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "c6b0b7cb0a30e2edbf7050c0119ef038cf0f0ac2"}}}' -m friendly` # Credits Inspired by https://github.com/slipset/friendly I learned the technique of loading code via a gist from https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202 -
bhb revised this gist
Jul 6, 2018 . 2 changed files with 36 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ {:paths ["."] :deps {venantius/pyro {:mvn/version "0.1.2"} expound {:mvn/version "0.7.1"}}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,40 @@ (ns friendly (:require [pyro.printer :as pyro] [expound.alpha :as expound] [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st] [clojure.stacktrace] [clojure.main])) (def printer (expound/custom-printer {:print-specs? false :show-valid-values? true :theme :figwheel-theme})) (defn repl-caught [e] (let [ex (clojure.main/repl-exception e) tr (.getStackTrace ex) el (when-not (zero? (count tr)) (aget tr 0)) ex-m (Throwable->map ex)] (binding [*out* *err*] ;; If the output is a clojure spec issue... (if (::s/problems (:data ex-m)) ;; print expound output (do (println (str (re-find #"Call to .* did not conform to spec\:" (.getMessage ex)) "\n" (with-out-str (printer (:data ex-m)))))) ;; otherwise print exception (println (str (if (instance? clojure.lang.Compiler$CompilerException ex) (str (-> ex class .getSimpleName) " " (.getMessage ex) " ") (str " " (if el (clojure.stacktrace/print-stack-trace ex) "[trace missing]"))))))))) (defn -main [] (set! s/*explain-out* printer) (st/instrument) (pyro/swap-stacktrace-engine!) (clojure.main/repl :caught repl-caught)) -
bhb revised this gist
May 29, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,4 @@ I learned the technique of loading code via a gist from https://gist.github.com/ Usage: `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "bb5806bd655d743f3b48b36ce83c0085a8d7c54a"}}}' -m friendly` -
bhb revised this gist
May 29, 2018 . 2 changed files with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ {:paths ["."] :deps {com.bhauman/rebel-readline {:mvn/version "0.1.3"} expound {:mvn/version "0.7.0"}}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,8 @@ [clojure.spec.test.alpha :as st])) (defn -main [] (set! s/*explain-out* (expound/custom-printer {:print-specs? false :show-valid-values? true :theme :figwheel-theme})) (st/instrument) (rebel-readline.main/-main)) -
bhb revised this gist
Apr 27, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,4 @@ I learned the technique of loading code via a gist from https://gist.github.com/ Usage: `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "9bd01f28522a0083c6a7428a871aa5fbb8070d1d"}}}' -m friendly` -
bhb revised this gist
Apr 27, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ {:paths ["."] :deps {com.bhauman/rebel-readline {:mvn/version "0.1.2"} expound {:mvn/version "0.6.0"}}} -
bhb revised this gist
Feb 28, 2018 . 2 changed files with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Inspired by https://github.com/slipset/friendly I learned the technique of loading code via a gist from https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202 Usage: `clj -Sdeps '{:deps {friendly {:git/url "https://gist.github.com/bhb/2686b023d074ac052dbc21f12f324f18" :sha "cbc5b3c73d4788a25570f125e5f2de23a3d2bf5f"}}}' -m friendly` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,3 @@ (ns friendly (:require [rebel-readline.main] [expound.alpha :as expound] -
bhb revised this gist
Feb 28, 2018 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ ;; Inspired by https://github.com/slipset/friendly ;; I learned the technique of loading code via a gist from ;; https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202 (ns friendly (:require [rebel-readline.main] [expound.alpha :as expound] -
bhb revised this gist
Feb 28, 2018 . No changes.There are no files selected for viewing
-
bhb created this gist
Feb 28, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ {:paths ["."] :deps {rebel-readline {:mvn/version "0.1.1-SNAPSHOT"} expound {:mvn/version "0.5.0"}}} This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ ;; Inspired by https://github.com/slipset/friendly (ns friendly (:require [rebel-readline.main] [expound.alpha :as expound] [clojure.spec.alpha :as s] [clojure.spec.test.alpha :as st])) (defn -main [] (set! s/*explain-out* (expound/custom-printer {:print-specs? false :show-valid-values? true})) (st/instrument) (rebel-readline.main/-main))