Browse code
chore: don't use defun-ct because it's unnecessary
Edward Langley authored on 26/03/2023 18:12:43
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -63,11 +63,11 @@ |
63 | 63 |
when (equal key a-key) do |
64 | 64 |
(return (car value))))))) |
65 | 65 |
|
66 |
-(defun-ct == (target &key (test 'eql)) |
|
66 |
+(defun == (target &key (test 'eql)) |
|
67 | 67 |
(lambda (v) |
68 | 68 |
(funcall test target v))) |
69 | 69 |
|
70 |
-(defun-ct deduplicate (&optional (test 'eql)) |
|
70 |
+(defun deduplicate (&optional (test 'eql)) |
|
71 | 71 |
(lambda (it) |
72 | 72 |
(remove-duplicates it :test test))) |
73 | 73 |
|
... | ... |
@@ -93,29 +93,29 @@ |
93 | 93 |
(lambda (acc next) |
94 | 94 |
(matching-list-reducer test acc next))) |
95 | 95 |
|
96 |
-(defun-ct compress-runs (&key (collector 'cons-new) (test 'eql) (key 'identity)) |
|
96 |
+(defun compress-runs (&key (collector 'cons-new) (test 'eql) (key 'identity)) |
|
97 | 97 |
(lambda (it) |
98 | 98 |
(nreverse |
99 | 99 |
(reduce (funcall collector :test test :key key) |
100 | 100 |
it |
101 | 101 |
:initial-value ())))) |
102 | 102 |
|
103 |
-(defun-ct of-length (len) |
|
103 |
+(defun of-length (len) |
|
104 | 104 |
(lambda (it) |
105 | 105 |
(= (length it) |
106 | 106 |
len))) |
107 | 107 |
|
108 |
-(defun-ct of-min-length (len) |
|
108 |
+(defun of-min-length (len) |
|
109 | 109 |
(lambda (it) |
110 | 110 |
(>= (length it) |
111 | 111 |
len))) |
112 | 112 |
|
113 |
-(defun-ct of-max-length (len) |
|
113 |
+(defun of-max-length (len) |
|
114 | 114 |
(lambda (it) |
115 | 115 |
(<= (length it) |
116 | 116 |
len))) |
117 | 117 |
|
118 |
-(defun-ct applicable-when (fun test) |
|
118 |
+(defun applicable-when (fun test) |
|
119 | 119 |
(lambda (it) |
120 | 120 |
(if (funcall test it) |
121 | 121 |
(funcall fun it) |
... | ... |
@@ -137,16 +137,16 @@ |
137 | 137 |
fns))))) |
138 | 138 |
|
139 | 139 |
|
140 |
-(defun-ct sorted (comparator &rest r &key key) |
|
140 |
+(defun sorted (comparator &rest r &key key) |
|
141 | 141 |
(declare (ignore key)) |
142 | 142 |
(lambda (it) |
143 | 143 |
(apply #'stable-sort (copy-seq it) comparator r))) |
144 | 144 |
|
145 |
-(defun-ct element (num) |
|
145 |
+(defun element (num) |
|
146 | 146 |
(lambda (it) |
147 | 147 |
(elt it num))) |
148 | 148 |
|
149 |
-(defun-ct key (key) |
|
149 |
+(defun key (key) |
|
150 | 150 |
(lambda (map) |
151 | 151 |
(declare (dynamic-extent map)) |
152 | 152 |
(extract-key map key))) |
... | ... |
@@ -157,19 +157,19 @@ |
157 | 157 |
for cur = (extract-key map key) then (extract-key cur key) |
158 | 158 |
finally (return cur)))) |
159 | 159 |
|
160 |
-(defun-ct regex-match (regex) |
|
160 |
+(defun regex-match (regex) |
|
161 | 161 |
(lambda (data) |
162 | 162 |
(cl-ppcre:scan-to-strings regex data))) |
163 | 163 |
|
164 |
-(defun-ct include (pred) |
|
164 |
+(defun include (pred) |
|
165 | 165 |
(lambda (seq) |
166 | 166 |
(remove-if-not pred seq))) |
167 | 167 |
|
168 |
-(defun-ct exclude (pred) |
|
168 |
+(defun exclude (pred) |
|
169 | 169 |
(lambda (seq) |
170 | 170 |
(remove-if pred seq))) |
171 | 171 |
|
172 |
-(defun-ct pick (selector) |
|
172 |
+(defun pick (selector) |
|
173 | 173 |
(lambda (seq) |
174 | 174 |
(map 'list selector seq))) |
175 | 175 |
|
... | ... |
@@ -177,13 +177,13 @@ |
177 | 177 |
(lambda (it) |
178 | 178 |
(subseq it start end))) |
179 | 179 |
|
180 |
-(defun-ct update (thing fun &rest args) |
|
180 |
+(defun update (thing fun &rest args) |
|
181 | 181 |
(apply fun thing args)) |
182 | 182 |
|
183 | 183 |
(define-modify-macro updatef (fun &rest args) |
184 | 184 |
update) |
185 | 185 |
|
186 |
-(defun-ct suffixp (suffix &key (test 'eql test-p)) |
|
186 |
+(defun suffixp (suffix &key (test 'eql test-p)) |
|
187 | 187 |
(lambda (it) |
188 | 188 |
(if test-p |
189 | 189 |
(alexandria:ends-with-subseq suffix |
... | ... |
@@ -192,7 +192,7 @@ |
192 | 192 |
(alexandria:ends-with-subseq suffix |
193 | 193 |
it)))) |
194 | 194 |
|
195 |
-(defun-ct transform-head (fun) |
|
195 |
+(defun transform-head (fun) |
|
196 | 196 |
(lambda (it) |
197 | 197 |
(typecase it |
198 | 198 |
(list (list* (funcall fun (car it)) |
... | ... |
@@ -201,7 +201,7 @@ |
201 | 201 |
(prog1 result |
202 | 202 |
(updatef (elt result 0) fun))))))) |
203 | 203 |
|
204 |
-(defun-ct transform-tail (fun) |
|
204 |
+(defun transform-tail (fun) |
|
205 | 205 |
(lambda (it) |
206 | 206 |
(typecase it |
207 | 207 |
(list (list* (car it) |
... | ... |
@@ -211,25 +211,25 @@ |
211 | 211 |
(updatef (subseq result 1) |
212 | 212 |
fun))))))) |
213 | 213 |
|
214 |
-(defun-ct splice-elt (elt fun) |
|
214 |
+(defun splice-elt (elt fun) |
|
215 | 215 |
(lambda (it) |
216 | 216 |
(append (subseq it 0 elt) |
217 | 217 |
(funcall fun (nth elt it)) |
218 | 218 |
(subseq it (1+ elt))))) |
219 | 219 |
|
220 |
-(defun-ct transform-elt (elt fun) |
|
220 |
+(defun transform-elt (elt fun) |
|
221 | 221 |
(lambda (it) |
222 | 222 |
(append (subseq it 0 elt) |
223 | 223 |
(list (funcall fun (nth elt it))) |
224 | 224 |
(subseq it (1+ elt))))) |
225 | 225 |
|
226 |
-(defun-ct key-transform (fun key-get key-set) |
|
226 |
+(defun key-transform (fun key-get key-set) |
|
227 | 227 |
(lambda (it) |
228 | 228 |
(let ((key-val (funcall key-get it))) |
229 | 229 |
(funcall key-set |
230 | 230 |
(funcall fun key-val))))) |
231 | 231 |
|
232 |
-(defun-ct juxt (fun1 &rest r) |
|
232 |
+(defun juxt (fun1 &rest r) |
|
233 | 233 |
(lambda (&rest args) |
234 | 234 |
(list* (apply fun1 args) |
235 | 235 |
(when r |
... | ... |
@@ -249,7 +249,7 @@ |
249 | 249 |
(prog1 (funcall fun1 i) |
250 | 250 |
(funcall fun2)))) |
251 | 251 |
|
252 |
-(defun-ct derive (diff-fun &key (key #'identity)) |
|
252 |
+(defun derive (diff-fun &key (key #'identity)) |
|
253 | 253 |
(lambda (seq) |
254 | 254 |
(typecase seq |
255 | 255 |
(list (cons (cons nil (car seq)) |
... | ... |
@@ -270,12 +270,12 @@ |
270 | 270 |
else collect (cons nil next)) |
271 | 271 |
'vector))))) |
272 | 272 |
|
273 |
-(defun-ct inc (inc) |
|
273 |
+(defun inc (inc) |
|
274 | 274 |
(declare (optimize (speed 3))) |
275 | 275 |
(lambda (base) |
276 | 276 |
(+ base inc))) |
277 | 277 |
|
278 |
-(defun-ct cumsum |
|
278 |
+(defun cumsum |
|
279 | 279 |
(&key (add-fun #'+) (key #'identity) (combine (lambda (x y) y x)) (zero 0)) |
280 | 280 |
(lambda (seq) |
281 | 281 |
(nreverse |
... | ... |
@@ -291,12 +291,12 @@ |
291 | 291 |
seq |
292 | 292 |
:initial-value ())))) |
293 | 293 |
|
294 |
-(defun-ct over (fun &key (result-type 'list)) |
|
294 |
+(defun over (fun &key (result-type 'list)) |
|
295 | 295 |
(let ((fun (functionalize fun))) |
296 | 296 |
(lambda (seq) |
297 | 297 |
(map result-type fun seq)))) |
298 | 298 |
|
299 |
-(defun-ct denest (&key (result-type 'list)) |
|
299 |
+(defun denest (&key (result-type 'list)) |
|
300 | 300 |
(lambda (seq) |
301 | 301 |
(apply #'concatenate result-type |
302 | 302 |
seq))) |
... | ... |
@@ -312,7 +312,7 @@ |
312 | 312 |
(lambda (,seq) |
313 | 313 |
(apply ,fsym ,@args ,seq))))) |
314 | 314 |
|
315 |
-(defun-ct on (fun key) |
|
315 |
+(defun on (fun key) |
|
316 | 316 |
"Transform arguments with KEY and then apply FUN |
317 | 317 |
|
318 | 318 |
> (eql (funcall (on 'equal 'car) |
... | ... |
@@ -329,7 +329,7 @@ |
329 | 329 |
(make-sequence 'vector (- length2 length1) :initial-element fill-value) |
330 | 330 |
#())) |
331 | 331 |
|
332 |
-(defun-ct zipping (result-type &key (fill-value nil fill-value-p)) |
|
332 |
+(defun zipping (result-type &key (fill-value nil fill-value-p)) |
|
333 | 333 |
(lambda (seq1 seq2) |
334 | 334 |
(let ((length1 (when fill-value-p (length seq1))) |
335 | 335 |
(length2 (when fill-value-p (length seq2)))) |
... | ... |
@@ -346,7 +346,7 @@ |
346 | 346 |
(map result-type #'list |
347 | 347 |
seq1 seq2))))) |
348 | 348 |
|
349 |
-(defun-ct maximizing (relation measure) |
|
349 |
+(defun maximizing (relation measure) |
|
350 | 350 |
(lambda (it) |
351 | 351 |
(let ((it-length (length it))) |
352 | 352 |
(when (> it-length 0) |
... | ... |
@@ -361,7 +361,7 @@ |
361 | 361 |
it |
362 | 362 |
(alexandria:iota it-length)))))))) |
363 | 363 |
|
364 |
-(defun-ct group-by (fn &key (test 'equal)) |
|
364 |
+(defun group-by (fn &key (test 'equal)) |
|
365 | 365 |
(lambda (seq) |
366 | 366 |
(let ((groups (make-hash-table :test test))) |
367 | 367 |
(map nil |