## [Series-users] collect-series ?

 [Series-users] collect-series ? From: Chris Dean - 2005-12-09 20:40:20 ```Is there a way to use gathering to collect a series? For example, here's a function that uses gathering and scan to produce a series as a result: (defun foo () (scan (gathering ((res collect)) (next-out res 1) (next-out res 2) (next-out res 3)))) Even if it just syntactic sugar, I'd rather type something like (defun foo2 () (gathering ((res collect-series)) (next-out res 1) (next-out res 2) (next-out res 3))) Thanks for any pointers. Regards, Chris Dean ```

 [Series-users] collect-series ? From: Chris Dean - 2005-12-09 20:40:20 ```Is there a way to use gathering to collect a series? For example, here's a function that uses gathering and scan to produce a series as a result: (defun foo () (scan (gathering ((res collect)) (next-out res 1) (next-out res 2) (next-out res 3)))) Even if it just syntactic sugar, I'd rather type something like (defun foo2 () (gathering ((res collect-series)) (next-out res 1) (next-out res 2) (next-out res 3))) Thanks for any pointers. Regards, Chris Dean ```
 Re: [Series-users] collect-series ? From: - 2005-12-13 13:56:00 ```>>>>> "Chris" == Chris Dean writes: Chris> Is there a way to use gathering to collect a series? For example, Chris> here's a function that uses gathering and scan to produce a series as Chris> a result: Chris> (defun foo () Chris> (scan (gathering ((res collect)) Chris> (next-out res 1) Chris> (next-out res 2) Chris> (next-out res 3)))) [snip] I'm not at all familiar with the generator/gather part of series. I'll have to think about this. Do you need to do it this way instead of using series itself? Ray ```
 Re: [Series-users] collect-series ? From: Chris Dean - 2005-12-13 19:07:53 ```Raymond Toy writes: > Chris> Is there a way to use gathering to collect a series? ... > I'm not at all familiar with the generator/gather part of series. > I'll have to think about this. Do you need to do it this way instead > of using series itself? I'm searching for the "right way" to handle the problem, so another way would be fine but the gathering code seemed like a natural fit. I used to have this code that returned a list of URLs from a string: (defun html-body->raw-urls (body &key use-javascript) (let ((res nil)) (do-scans (s e rs re *AHREF-RE* body) (push (subseq body (aref rs 0) (aref re 0)) res)) (do-scans (s e rs re *ANY-URL-RE* body) (push (subseq body (aref rs 0) (aref re 0)) res)) (when use-javascript (do-scans (s e rs re *JS-RE* body) (push (subseq body (aref rs 0) (aref re 0)) res))) res)) What I'd like to do is replace it with this code that returns a series: (defun html-body->raw-urls (body) (scan (gathering ((res collect)) (cl-ppcre:do-scans (s e rs re *AHREF-RE* body) (next-out res (subseq body (aref rs 0) (aref re 0)))) (cl-ppcre:do-scans (s e rs re *ANY-URL-RE* body) (next-out res (subseq body (aref rs 0) (aref re 0)))) (when use-javascript (do-scans (s e rs re *JS-RE* body) (next-out res (subseq body (aref rs 0) (aref re 0)))))))) If you can suggest any natural way of doing this, that would be wonderful. Regards, Chris Dean ```