This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-04
Channels
- # architecture (20)
- # aws (8)
- # beginners (13)
- # boot (9)
- # cider (80)
- # cljs-dev (69)
- # cljsrn (7)
- # clojure (243)
- # clojure-dusseldorf (8)
- # clojure-italy (5)
- # clojure-norway (3)
- # clojure-poland (57)
- # clojure-russia (10)
- # clojure-shanghai (2)
- # clojure-spec (11)
- # clojure-uk (50)
- # clojurescript (198)
- # core-async (11)
- # crypto (2)
- # cursive (14)
- # datomic (17)
- # figwheel (8)
- # garden (7)
- # hoplon (8)
- # incanter (4)
- # jobs (1)
- # leiningen (1)
- # liberator (38)
- # lumo (28)
- # om (55)
- # onyx (10)
- # pedestal (13)
- # perun (20)
- # re-frame (1)
- # reagent (16)
- # ring-swagger (9)
- # spacemacs (11)
- # test-check (9)
- # unrepl (43)
- # untangled (163)
- # yada (8)
"The Silence of the Lambdas"
Morning
Morning @yogidevbear
I'm sure I'm not along in this sentiment, but there really aren't enough hours in the day
or there are too many factors taking up my time from the things I really want/need to focus more on
I've found that having children does not help with this problem
Bore da
@glenjamin I wish I could tell my boss to up my pay and decrease my working hours 😉
the other thing with increasing day rate is if you're in an advisory/consultancy role your voice gets listened to more!
When was that a thing? Must have missed it!
@shan if you have a core function to share I'm sure we're all happy to learn about it...
clojure pills anyone? https://youtu.be/-KQ5K-MW4AU
((juxt :name :doc) (-> 'clojure.core the-ns ns-publics vals rand-nth meta))
sadly Clojurebot thinks this is too risky and won't run it
huh, what's bad about ns-publics
?
ah, yeah, that makes sense
the-ns
is also bad (and not actually needed here)
@benedek I love clojure.data/diff! Used it on a number of occasions. It's definitely as useful as juxt
(in my experience anyway)
Perfect for datomic's cardinality many types, where you can't "clobber" them (e.g. say that x = #{1 2 3}) You have to do a diff of current value (`#{3 4 5}`) and generate the list of things you're actually adding/removing.
I've been using clojure.data/diff
a lot in tests to make more sane error messages on equality failure of more complex data structures.
brittle tests can really be an impediment to change
diff in tests is super handy, so handy i made this:
(defmacro is-submap
[expected actual & [msg]]
`(try
(let [act# ~actual
exp# ~expected
[only-in-ex# only-in-ac# shared#] (clojure.data/diff exp# act#)]
(if only-in-ex#
(clojure.test/do-report {:type :fail
:message (or ~msg "Missing expected elements.")
:expected only-in-ex# :actual act#})
(clojure.test/do-report {:type :pass
:message "Matched"
:expected exp# :actual act#})))
(catch Throwable t#
(clojure.test/do-report {:type :error :message "Exception diffing"
:expected nil :actual t#}))))
@tcoupland useful! The only time I've ever written a macro (other than just playing around) was for testing to wrap kerodon expressions so that they return true or false rather than just output to the clojure.test/report-counters
so I could use kerodon expressions in normal is
tests (and in my case use kerodon in cucumber-jvm
tests). https://gist.github.com/chrishowejones/4e8c60e3bcf1573de543
testing is a good place for macro'ing i think, can be lots of repetition and fiddling about that won't quite fit into higher order fns. Plus, it is just good fun 🙂
Also unless you want you're tests to be very brittle you don't often compose them!
@tcoupland is that macro testing green with something like (is-submap nil anything-else)?
@reborg cld do, not tried it, but that would in some ways fit with the idea. It's only checking if you have the expected stuff and is intentionally uncaring about anything extra. So, if your minimum is nothing, then anything is fine.
@agile_geek are they usable in both contexts if you do that? Is that something that could be added to kerodon itself?
Hmm, not sure. Been a long time since I looked at that stuff
@tcoupland I suppose it depends and it might be perfectly fine. I guess I just wanted to highlight corner cases related with nils and data/diff.