git.fiddlerwoaroof.com
Browse code

feat: curried equality

Ed L authored on 01/10/2020 00:05:29
Showing 2 changed files
... ...
@@ -1,5 +1,8 @@
1 1
 (asdf:defsystem #:data-lens
2
-  :description "Utilities for building data transormations from composable functions, modeled on lenses and transducers"
2
+  :description #.(format nil "~a ~a ~a"
3
+                         "Utilities for building data transormations from"
4
+                         "composable functions, modeled on lenses and"
5
+                         "transducers")
3 6
   :author "Edward Langley <el-cl@elangley.org>"
4 7
   :license "MIT"
5 8
   :depends-on (:cl-ppcre
... ...
@@ -234,8 +234,9 @@ contain the new value at the location focused by the lens."
234 234
            #:compress-runs #:combine-matching-lists #:sorted #:applicable-when
235 235
            #:of-length #:of-min-length #:of-max-length #:transform-head
236 236
            #:maximizing #:zipping #:applying #:splice-elt #:transform-elt #:denest
237
-           #:op #:defalias #:<> #:<>1
238
-           #:•))
237
+           #:op #:defalias #:<> #:<>1 #:== #:•
238
+           ))
239
+             
239 240
 (in-package :data-lens)
240 241
 
241 242
 
... ...
@@ -275,6 +276,10 @@ contain the new value at the location focused by the lens."
275 276
                when (equal key a-key) do
276 277
                  (return (car value)))))))
277 278
 
279
+(defun-ct == (target &key (test 'eql))
280
+  (lambda (v)
281
+    (funcall test target v)))
282
+
278 283
 (defun-ct deduplicate (&optional (test 'eql))
279 284
   (lambda (it)
280 285
     (remove-duplicates it :test test)))