Skip to content
This repository was archived by the owner on Mar 20, 2020. It is now read-only.

Commit a2694c9

Browse files
author
philip-doctor
committed
sometimes tables need respect
1 parent 4f19567 commit a2694c9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/╯°□°╯.clj

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
[throwable]
66
(throw throwable))
77

8+
(defmacro v°□°v
9+
[& body]
10+
(loop [new-body `(try)
11+
[current-form & forms] body]
12+
(if current-form
13+
(if (= (second current-form) '╯°_°╯)
14+
(let [[old-first old-second old-third & others] current-form]
15+
(recur (concat new-body (list `(catch ~old-third ~old-first ~@others)))
16+
forms))
17+
(recur (concat new-body `(~current-form))
18+
forms))
19+
new-body)))
20+
821
(defn ╯°□°╯︵oɟuᴉ
922
"A shorthand for ╯°□°╯ with ex-info."
1023
([map]

test/╯°□°╯_test.clj

+4
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@
1111
(is (thrown-with-msg?
1212
Exception #"^╯°□°╯$"
1313
(╯°□°╯︵oɟuᴉ {}))))
14+
15+
(deftest v°□°v-test
16+
(is (= (v°□°v (/ 1 0) (┬─┬ ╯°_°╯ Exception "caught"))
17+
"caught")))

0 commit comments

Comments
 (0)