feat: curried equality

This commit is contained in:
Ed L
2020-09-30 17:05:29 -07:00
parent 800a03e0c6
commit 1dcfeff5de
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,8 @@
(asdf:defsystem #:data-lens
:description "Utilities for building data transormations from composable functions, modeled on lenses and transducers"
:description #.(format nil "~a ~a ~a"
"Utilities for building data transormations from"
"composable functions, modeled on lenses and"
"transducers")
:author "Edward Langley <el-cl@elangley.org>"
:license "MIT"
:depends-on (:cl-ppcre

View File

@ -234,8 +234,9 @@ contain the new value at the location focused by the lens."
#:compress-runs #:combine-matching-lists #:sorted #:applicable-when
#:of-length #:of-min-length #:of-max-length #:transform-head
#:maximizing #:zipping #:applying #:splice-elt #:transform-elt #:denest
#:op #:defalias #:<> #:<>1
#:))
#:op #:defalias #:<> #:<>1 #:== #:
))
(in-package :data-lens)
@ -275,6 +276,10 @@ contain the new value at the location focused by the lens."
when (equal key a-key) do
(return (car value)))))))
(defun-ct == (target &key (test 'eql))
(lambda (v)
(funcall test target v)))
(defun-ct deduplicate (&optional (test 'eql))
(lambda (it)
(remove-duplicates it :test test)))