Support cycle/focus-item
I oftentimes call `cycle/focus` and pass `(lambda (a) (equal a b))`. This function should tighten up my code.
This commit is contained in:
parent
3f54dd8601
commit
f145bc9eb6
1 changed files with 5 additions and 0 deletions
|
@ -131,6 +131,11 @@ underlying struct."
|
||||||
(cycle/jump i cycle)
|
(cycle/jump i cycle)
|
||||||
(error "No element in cycle matches predicate"))))
|
(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)
|
(defun cycle/contains? (x xs)
|
||||||
"Return t if cycle, XS, has member X."
|
"Return t if cycle, XS, has member X."
|
||||||
(->> xs
|
(->> xs
|
||||||
|
|
Loading…
Reference in a new issue