From f75af164ea8aa47e5da95168c74b8187cf83e735 Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Tue, 29 Mar 2022 21:08:55 -0700 Subject: [PATCH] feat(keys): add keys function --- lens.lisp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lens.lisp b/lens.lisp index 0a1faec..045c1f3 100644 --- a/lens.lisp +++ b/lens.lisp @@ -125,6 +125,12 @@ (declare (dynamic-extent map)) (extract-key map key))) +(defun keys (key &rest keys) + (lambda (map) + (loop for key in (cons key keys) + for cur = (extract-key map key) then (extract-key cur key) + finally (return cur)))) + (defun-ct regex-match (regex) (lambda (data) (cl-ppcre:scan-to-strings regex data)))