Skip to content

Commit 76c2510

Browse files
committed
Formatting: had to be done
1 parent 0f97dfa commit 76c2510

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2112
-2230
lines changed

src/datascript/built_ins.cljc

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(ns datascript.built-ins
22
(:require
3-
[clojure.string :as str]
4-
[datascript.db :as db]
5-
[datascript.impl.entity :as de]
6-
[datascript.util :as util]))
3+
[clojure.string :as str]
4+
[datascript.db :as db]
5+
[datascript.impl.entity :as de]
6+
[datascript.util :as util]))
77

88
(defn- -differ? [& xs]
99
(let [l (count xs)]
@@ -20,11 +20,11 @@
2020
(defn- -get-some
2121
[db e & as]
2222
(reduce
23-
(fn [_ a]
24-
(when-some [datom (first (db/-search db [(db/entid db e) a]))]
25-
(reduced [(:a datom) (:v datom)])))
26-
nil
27-
as))
23+
(fn [_ a]
24+
(when-some [datom (first (db/-search db [(db/entid db e) a]))]
25+
(reduced [(:a datom) (:v datom)])))
26+
nil
27+
as))
2828

2929
(defn- -missing?
3030
[db e a]
@@ -80,23 +80,23 @@
8080

8181
(def query-fns
8282
{'= =, '== ==, 'not= not=, '!= not=,
83-
'< less, '> greater, '<= less-equal, '>= greater-equal,
84-
'+ +, '- -, '* *, '/ /,
85-
'quot quot, 'rem rem, 'mod mod, 'inc inc, 'dec dec, 'max max, 'min min,
86-
'zero? zero?, 'pos? pos?, 'neg? neg?, 'even? even?, 'odd? odd?, 'compare compare,
87-
'rand rand, 'rand-int rand-int,
88-
'true? true?, 'false? false?, 'nil? nil?, 'some? some?, 'not not, 'and and-fn, 'or or-fn,
89-
'complement complement, 'identical? identical?,
90-
'identity identity, 'keyword keyword, 'meta meta, 'name name, 'namespace namespace, 'type type,
91-
'vector vector, 'list list, 'set set, 'hash-map hash-map, 'array-map array-map,
92-
'count count, 'range range, 'not-empty not-empty, 'empty? empty?, 'contains? contains?,
93-
'str str, 'subs, subs, 'get get,
94-
'pr-str pr-str, 'print-str print-str, 'println-str println-str, 'prn-str prn-str,
95-
're-find re-find, 're-matches re-matches, 're-seq re-seq, 're-pattern re-pattern,
96-
'-differ? -differ?, 'get-else -get-else, 'get-some -get-some, 'missing? -missing?, 'ground identity,
97-
'clojure.string/blank? str/blank?, 'clojure.string/includes? str/includes?,
98-
'clojure.string/starts-with? str/starts-with?, 'clojure.string/ends-with? str/ends-with?
99-
'tuple vector, 'untuple identity})
83+
'< less, '> greater, '<= less-equal, '>= greater-equal,
84+
'+ +, '- -, '* *, '/ /,
85+
'quot quot, 'rem rem, 'mod mod, 'inc inc, 'dec dec, 'max max, 'min min,
86+
'zero? zero?, 'pos? pos?, 'neg? neg?, 'even? even?, 'odd? odd?, 'compare compare,
87+
'rand rand, 'rand-int rand-int,
88+
'true? true?, 'false? false?, 'nil? nil?, 'some? some?, 'not not, 'and and-fn, 'or or-fn,
89+
'complement complement, 'identical? identical?,
90+
'identity identity, 'keyword keyword, 'meta meta, 'name name, 'namespace namespace, 'type type,
91+
'vector vector, 'list list, 'set set, 'hash-map hash-map, 'array-map array-map,
92+
'count count, 'range range, 'not-empty not-empty, 'empty? empty?, 'contains? contains?,
93+
'str str, 'subs, subs, 'get get,
94+
'pr-str pr-str, 'print-str print-str, 'println-str println-str, 'prn-str prn-str,
95+
're-find re-find, 're-matches re-matches, 're-seq re-seq, 're-pattern re-pattern,
96+
'-differ? -differ?, 'get-else -get-else, 'get-some -get-some, 'missing? -missing?, 'ground identity,
97+
'clojure.string/blank? str/blank?, 'clojure.string/includes? str/includes?,
98+
'clojure.string/starts-with? str/starts-with?, 'clojure.string/ends-with? str/ends-with?
99+
'tuple vector, 'untuple identity})
100100

101101
;; Aggregates
102102

@@ -113,7 +113,7 @@
113113
(cond-> (nth terms med)
114114
(even? size)
115115
(-> (+ (nth terms (dec med)))
116-
(/ 2)))))
116+
(/ 2)))))
117117

118118
(defn- aggregate-variance [coll]
119119
(let [mean (aggregate-avg coll)
@@ -138,11 +138,11 @@
138138
(reduce (fn [acc x]
139139
(cond
140140
(< (count acc) n)
141-
(sort compare (conj acc x))
141+
(sort compare (conj acc x))
142142
(neg? (compare x (last acc)))
143-
(sort compare (conj (butlast acc) x))
143+
(sort compare (conj (butlast acc) x))
144144
:else acc))
145-
[] coll))))
145+
[] coll))))
146146

147147
(defn- aggregate-max
148148
([coll]
@@ -152,15 +152,15 @@
152152
x acc))
153153
(first coll) (next coll)))
154154
([n coll]
155-
(vec
156-
(reduce (fn [acc x]
157-
(cond
158-
(< (count acc) n)
159-
(sort compare (conj acc x))
160-
(pos? (compare x (first acc)))
161-
(sort compare (conj (next acc) x))
162-
:else acc))
163-
[] coll))))
155+
(vec
156+
(reduce (fn [acc x]
157+
(cond
158+
(< (count acc) n)
159+
(sort compare (conj acc x))
160+
(pos? (compare x (first acc)))
161+
(sort compare (conj (next acc) x))
162+
:else acc))
163+
[] coll))))
164164

165165
(defn- aggregate-rand
166166
([coll] (rand-nth coll))

src/datascript/core.cljc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
[datascript.impl.entity Entity]
1919
[java.util UUID])))
2020

21-
(def ^:const ^:no-doc tx0 db/tx0)
21+
(def ^:const ^:no-doc tx0
22+
db/tx0)
2223

2324

2425
; Entities

src/datascript/datafy.cljc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
(ns datascript.datafy
2-
(:require [clojure.core.protocols :as cp]
3-
[datascript.pull-api :as dp]
4-
[datascript.db :as db]
5-
[datascript.impl.entity :as e]))
2+
(:require
3+
[clojure.core.protocols :as cp]
4+
[datascript.pull-api :as dp]
5+
[datascript.db :as db]
6+
[datascript.impl.entity :as e]))
67

78
(declare datafy-entity-seq)
89

@@ -11,23 +12,23 @@
1112
ref-rattrs (set (map db/reverse-ref ref-attrs))
1213
many-attrs (:db.cardinality/many (:rschema db-val))]
1314
(with-meta pulled-entity
14-
{`cp/nav (fn [coll k v]
15-
(cond
16-
(or (and (many-attrs k) (ref-attrs k))
17-
(ref-rattrs k))
18-
(datafy-entity-seq db-val v)
19-
(ref-attrs k)
20-
(e/entity db-val (:db/id v))
21-
:else v))})))
15+
{`cp/nav (fn [coll k v]
16+
(cond
17+
(or (and (many-attrs k) (ref-attrs k))
18+
(ref-rattrs k))
19+
(datafy-entity-seq db-val v)
20+
(ref-attrs k)
21+
(e/entity db-val (:db/id v))
22+
:else v))})))
2223

2324
(defn- navize-pulled-entity-seq [db-val entities]
2425
(with-meta entities
25-
{`cp/nav (fn [coll k v]
26-
(e/entity db-val (:db/id v)))}))
26+
{`cp/nav (fn [coll k v]
27+
(e/entity db-val (:db/id v)))}))
2728

2829
(defn- datafy-entity-seq [db-val entities]
2930
(with-meta entities
30-
{`cp/datafy (fn [entities] (navize-pulled-entity-seq db-val entities))}))
31+
{`cp/datafy (fn [entities] (navize-pulled-entity-seq db-val entities))}))
3132

3233
(extend-protocol cp/Datafiable
3334
datascript.impl.entity.Entity

0 commit comments

Comments
 (0)