This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-28
Channels
- # announcements (1)
- # beginners (183)
- # boot (2)
- # clara (4)
- # cljs-dev (20)
- # clojure (59)
- # clojure-dev (7)
- # clojure-nl (1)
- # clojure-serbia (1)
- # clojure-sg (1)
- # clojure-spec (4)
- # clojure-uk (15)
- # clojurescript (77)
- # clr (1)
- # data-science (9)
- # datomic (23)
- # docs (3)
- # duct (15)
- # emacs (8)
- # events (1)
- # fulcro (6)
- # instaparse (3)
- # juxt (1)
- # lumo (9)
- # off-topic (18)
- # perun (2)
- # portkey (13)
- # reagent (2)
- # reitit (11)
- # ring (10)
- # shadow-cljs (158)
- # tools-deps (34)
@phil672 from the sound of it tangle
might be what you're looking for: https://orgmode.org/manual/tangle.html
Thank you, that's interesting....the problem with tangle I think is that it gives the org-mode primacy, I was hoping for more of an import-from-file rather than export-to-file. I think my best bet actually is for the org code blocks to read the clojure as data, and then print the output:
#+begin_src clojure :results output
(clojure.repl/source )
#+end_src
I wrote a blog post on something that i've been developing. An embeddable scripting language. http://benzaporzan.me/blog/2018/5/28/fif__an_introduction/
user=> (+ "a")
ClassCastException Cannot cast java.lang.String to java.lang.Number java.lang.Class.cast (Class.java:3369)
Wondering if a better message would be ClassCastException Cannot cast java.lang.String ("a") to java.lang.Number
i.e. inline the faulty value, instead of making me find the right file/line to jump to, and place a debugging statement accordingly@vemv if you really want to have a more useful error message you might want to use clojure.spec + expound. maybe there is already a core spec for +
, if not, write it yourself
Yeah that would be the conventional wisdom these days... wondering if I can cheat a little 🙂
Doing it at clojure.core level seems tempting (and it works), that way I get debug info even when I wasn't expecting a ClassCastException (and therefore my code wasn't wrapped with try/catch)
(def cce-culprit (atom nil))
(alter-var-root #'clojure.core/cast
(constantly (fn [^Class c x]
(try
(. c (cast x))
(catch ClassCastException e
(reset! cce-culprit x)
(throw e))))))
Could be a nice dev-env-only addition in my projects.+ is inlined and you can’t instrument specs on inlined functions
Because you don’t go through the var