Fork me on GitHub
#clojure-uk
<
2018-03-22
>
thomas09:03:24

moin moin morning

yogidevbear09:03:55

I think 🌅 is a pretty accurate summation of the day 😎

yogidevbear09:03:22

What's it like up north?

yogidevbear10:03:37

@mccraigmccraig any chance of you coming through to Horsham next Wednesday evening? I know you said you might have something on

mccraigmccraig11:03:49

i'm planning on coming @yogidevbear - there are apparently no invisible appointments in my calendar 🙂

🎉 4
mccraigmccraig11:03:18

(it's the invisible, yet unavoidable, appointments that always trip me up)

yogidevbear11:03:03

I can relate to those 🙂 Well, hopefully we'll see you there

yogidevbear11:03:11

Hi @jasonbell 🙂

👍 4
mccraigmccraig15:03:18

our latest cassandra stream-joining stuff is looking pretty good now @otfrom https://gist.github.com/mccraigmccraig/ff1b7fc16eef3a37d1f0d6770fdae9c0

✨ 4
djtango18:03:41

I just solved this after a bit of headscratching... anyone want to have a guess at this?

(testing (is (thrown? AssertionError (assert (= 1 0)))))
;; 0 failures, 0 errors.
(testing (is (thrown? AssertionError (map #(assert (= % 0)) [1]))))) ;; edited from (assert (map #(= % 0) [1]))
;; FAIL 
;; expected: (thrown? AssertionError (assert (map (fn* [p1__21975#] (= p1__21975# 0)) [1])))
;; actual: nil

dominicm18:03:26

[false] is truthy

dominicm18:03:45

I don't know if that means I'm right or wrong 😂

djtango18:03:02

ah haha. You were off the mark, I'm sorry to say!

djtango18:03:33

So in the first case: I have a top level assert. In the second: I am trying to assert a property across a sequence

dominicm18:03:03

That's what I'm getting at. By asserting the whole sequence, that is truthy.

djtango18:03:20

ok cool, that wasn't it

dominicm18:03:28

But the result of the map is [false], and that always asserts true. But what you meant to do was (run! assert) over that.

djtango18:03:42

hmmm, what do you mean?

djtango18:03:01

I just ran this in the repl:

user=> (map #(assert (= % 1)) [1])
(nil)
user=> (map #(assert (= % 1)) [0])
AssertionError Assert failed: (= p1__23074# 1)  forecast-watcher.core/eval23075/fn--23076 (form-init2564455833876217160.clj:1)

djtango18:03:38

>But what you meant to do was (run! assert) over that. Curious about this ^

djtango18:03:27

ahhh rats! sorry there's a bug in my tiny example - I've fixed it now

djtango18:03:56

You were on the mark with run! though, I was surprised to find out that thrown? doesn't realise lazy results

djtango18:03:41

So to complete the rest:

(testing (is (thrown? AssertionError (assert (= 1 0)))))
;; 0 failures, 0 errors.
(testing (is (thrown? AssertionError (map #(assert (= % 0)) [1]))))
;; FAIL 
;; expected: (thrown? AssertionError (assert (map (fn* [p1__21975#] (= p1__21975# 0)) [1])))
;; actual: nil
(testing (is (thrown? AssertionError (doall (map #(assert (= % 0)) [1])))))
;; 0 failures, 0 errors.
(testing (is (thrown? AssertionError (mapv #(assert (= % 0)) [1]))))
;; 0 failures, 0 errors.