From cf67a11e13ad0d3de60af09f367eacd125ae3347 Mon Sep 17 00:00:00 2001 From: Edward Date: Wed, 30 Dec 2020 22:07:09 -0800 Subject: [PATCH] feat(utils): add SUFFIXP to test that a sequence has a suffix --- lens.lisp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lens.lisp b/lens.lisp index b4a3564..1740e42 100644 --- a/lens.lisp +++ b/lens.lisp @@ -151,6 +151,15 @@ (define-modify-macro updatef (fun &rest args) update) +(defun-ct suffixp (suffix &key (test 'eql test-p)) + (lambda (it) + (if test-p + (alexandria:ends-with-subseq suffix + it + :test test) + (alexandria:ends-with-subseq suffix + it)))) + (defun-ct transform-head (fun) (lambda (it) (typecase it