# HG changeset patch
# User Steve Losh <steve@stevelosh.com>
# Date 1512238038 18000
# Node ID 08b21b4d8af674d1693fb7184d5f5fc3ea775611
# Parent  8cf0978477a82e6165560e818346d84ae398a832
Make `somelist` variadic

diff -r 8cf0978477a8 -r 08b21b4d8af6 losh.lisp
--- a/losh.lisp	Sat Dec 02 12:48:23 2017 -0500
+++ b/losh.lisp	Sat Dec 02 13:07:18 2017 -0500
@@ -2204,14 +2204,19 @@
 
 
 ;;;; Lists --------------------------------------------------------------------
-(defun somelist (predicate list)
+(defun somelist (predicate list &rest more-lists)
   "Call `predicate` on successive sublists of `list`, returning the first true result.
 
   `somelist` is to `some` as `maplist` is to `mapcar`.
 
   "
-  (iterate (for l :on list)
-           (thereis (funcall predicate l))))
+  (if more-lists
+    (iterate
+      (for lists :first (cons list more-lists) :then (mapcar #'cdr lists))
+      (until (some #'null lists))
+      (thereis (apply predicate lists)))
+    (iterate (for l :on list)
+             (thereis (funcall predicate l)))))
 
 
 ;;;; Debugging & Logging ------------------------------------------------------