Browse code
feat(utils): add SUFFIXP to test that a sequence has a suffix
Edward authored on 31/12/2020 06:07:09
Showing 1 changed files
Showing 1 changed files
... | ... |
@@ -151,6 +151,15 @@ |
151 | 151 |
(define-modify-macro updatef (fun &rest args) |
152 | 152 |
update) |
153 | 153 |
|
154 |
+(defun-ct suffixp (suffix &key (test 'eql test-p)) |
|
155 |
+ (lambda (it) |
|
156 |
+ (if test-p |
|
157 |
+ (alexandria:ends-with-subseq suffix |
|
158 |
+ it |
|
159 |
+ :test test) |
|
160 |
+ (alexandria:ends-with-subseq suffix |
|
161 |
+ it)))) |
|
162 |
+ |
|
154 | 163 |
(defun-ct transform-head (fun) |
155 | 164 |
(lambda (it) |
156 | 165 |
(typecase it |