Browse code
refactor: minor refactors, start using transducers
Edward authored on 19/05/2021 08:28:14
Showing 3 changed files
Showing 3 changed files
... | ... |
@@ -38,10 +38,12 @@ |
38 | 38 |
(fw.lu:v-assoc :committer (metadata object) |
39 | 39 |
:test 'string-equal))) |
40 | 40 |
(defmethod component ((component (eql :parents)) (object git-commit)) |
41 |
- (coerce (remove-if-not (serapeum:op |
|
42 |
- (string= "parent" _)) |
|
43 |
- (metadata object) |
|
44 |
- :key #'car) |
|
45 |
- 'list)) |
|
41 |
+ (data-lens.transducers:into '() |
|
42 |
+ (data-lens:• |
|
43 |
+ (data-lens.transducers:filtering |
|
44 |
+ (data-lens:on (data-lens:== "parent" :test 'equal) |
|
45 |
+ #'car)) |
|
46 |
+ (data-lens.transducers:mapping #'cadr)) |
|
47 |
+ (metadata object))) |
|
46 | 48 |
(defmethod component ((component (eql :message)) (object git-commit)) |
47 | 49 |
(data object)) |
... | ... |
@@ -76,19 +76,19 @@ |
76 | 76 |
(version 4) |
77 | 77 |
(fanout 8) |
78 | 78 |
(shas (+ fanout |
79 |
- (* 4 256))) |
|
79 |
+ #.(* 4 256))) |
|
80 | 80 |
(packed-crcs (+ shas |
81 |
- (* 20 object-count))) |
|
81 |
+ (* 20 object-count))) |
|
82 | 82 |
(4-byte-offsets (+ packed-crcs |
83 |
- (* 4 object-count))) |
|
83 |
+ (* 4 object-count))) |
|
84 | 84 |
(8-byte-offsets-pro (+ 4-byte-offsets |
85 |
- (* object-count 4))) |
|
85 |
+ (* object-count 4))) |
|
86 | 86 |
(pack-sha (- (file-length idx-stream) |
87 |
- 40)) |
|
87 |
+ 40)) |
|
88 | 88 |
(8-byte-offsets (when (/= 8-byte-offsets-pro pack-sha) |
89 | 89 |
8-byte-offsets-pro)) |
90 | 90 |
(idx-sha (- (file-length idx-stream) |
91 |
- 20))) |
|
91 |
+ 20))) |
|
92 | 92 |
(values (sym->plist signature |
93 | 93 |
version |
94 | 94 |
fanout |
... | ... |
@@ -137,4 +137,3 @@ |
137 | 137 |
(read-object-metadata-from-pack pack)) |
138 | 138 |
(:offset . ,offset)) |
139 | 139 |
result))))) |
140 |
- |