From f145bc9eb6f1bc51fd70a3df02c978b3333fa012 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 8 Feb 2020 15:55:59 +0000 Subject: [PATCH] Support cycle/focus-item I oftentimes call `cycle/focus` and pass `(lambda (a) (equal a b))`. This function should tighten up my code. --- emacs/.emacs.d/wpc/cycle.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emacs/.emacs.d/wpc/cycle.el b/emacs/.emacs.d/wpc/cycle.el index 592de10e0..f876cf705 100644 --- a/emacs/.emacs.d/wpc/cycle.el +++ b/emacs/.emacs.d/wpc/cycle.el @@ -131,6 +131,11 @@ underlying struct." (cycle/jump i cycle) (error "No element in cycle matches predicate")))) +(defun cycle/focus-item (x xs) + "Focus ITEM in cycle XS. +ITEM is the first item in XS that t for `equal'." + (cycle/focus (lambda (y) (equal x y)) xs)) + (defun cycle/contains? (x xs) "Return t if cycle, XS, has member X." (->> xs