I'm using CL-PPCRE, and some functions return lists of start and end matches, so a return might be
(0 2 4 7 10 15), three matches.
Right now I loop over the matches like
(loop :for match :on (all-matches scanner text :start start) :by
#'cddr
:do (let ((start (first match))
(end (second match)))
(subseq text start end))
Is there a nicer way to gather the pairs than that?
LOOP destructures. Try this:
(loop for (start end) on (all-matches ...) by #'cddr do ...)
Gauche Scheme
(use util.match)
(match-let loop (((k v . more) '(a 2 b 3 c 4)))
(print (list k v))
(when (pair? more) (loop more)))
(a 2)
(b 3)
(c 4)
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)