Skip to content

Commit 0c4bd2b

Browse files
committed
Indent example file
remove comments for fixed indent style add type related functions
1 parent ff5d7e1 commit 0c4bd2b

File tree

1 file changed

+61
-14
lines changed

1 file changed

+61
-14
lines changed

test/indentation.clj

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
(java.util Date
66
UUID)))
77

8-
; https://tonsky.me/blog/clojurefmt/#ok-what-do-we-do-then
8+
; Single ; comment
9+
;; double ; comment
910
(when something
11+
; single ; comment
12+
;; double ; comment
1013
body)
1114

1215
(defmethod dispatch :on-me
@@ -47,25 +50,69 @@
4750
#{a b c
4851
d e f}
4952

50-
; second cond is not aligned
53+
5154
(or (condition-a)
5255
(condition-b))
5356

54-
; or/and are the only forms where this looks not ideal
55-
; other forms don’t win/lose much because of this change
56-
(filter even?
57-
(range 1 10))
57+
(filter even? (range 1 10))
5858

59-
; my way is actually better if fn name is looooooooooong
6059
(clojure.core/filter even?
61-
(range 1 10))
60+
(range 1 10))
61+
6262

63-
; 1 additional space, no big deal
6463
(filter
65-
even?
66-
(range 1 10))
64+
even?
65+
(range 1 10))
66+
67+
(asdf
68+
asdf
69+
asdf)
70+
71+
(defn foo [x 1]
72+
x)
6773

6874
(:my/keyword
69-
{:my/keyword 1
70-
:another-keyword 2}
71-
"default value")
75+
{:my/keyword 1
76+
:another-keyword 2}
77+
"default value")
78+
79+
80+
81+
(defprotocol IProto
82+
(foo [this x])
83+
(bar [this y]))
84+
85+
(deftype MyThing []
86+
IProto
87+
(foo [this x]
88+
x))
89+
90+
(defrecord MyThingR []
91+
IProto
92+
(foo [this x] x))
93+
94+
(defn foo2 [x]b)
95+
96+
(reify
97+
IProto
98+
(foo [this x]
99+
x))
100+
101+
(extend-type MyThing
102+
clojure.lang.IFn
103+
(invoke [this] 1))
104+
105+
(extend-protocol clojure.lang.IFn
106+
MyThingR
107+
(invoke [this]
108+
2))
109+
110+
(extend AType
111+
AProtocol
112+
{:foo an-existing-fn
113+
:bar (fn [a b]
114+
a)
115+
:baz (fn
116+
([a] a)
117+
([a b]
118+
b))})

0 commit comments

Comments
 (0)