cl-rw

Layered streams for Common Lisp
git clone https://logand.com/git/cl-rw.git/
Log | Files | Refs

commit ae596097844679ea388dc014c2ffa656b1a4477e
parent 6bcf67551d19a877fcbb2f859d20fc5c4500ec27
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sat, 21 Oct 2017 20:23:14 +0200

nicer filter-reader

Diffstat:
Mrw.lisp | 15+++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/rw.lisp b/rw.lisp @@ -515,14 +515,13 @@ (or x :empty-line)))))) (defun filter-reader (reader predicate) - (lambda () - (block found - (loop - (let ((x (next reader))) - (unless x - (return-from found nil)) - (when (funcall predicate x) - (return-from found x))))))) + (labels ((rec () + (let ((x (next reader))) + (when x + (if (funcall predicate x) + x + (rec)))))) + #'rec)) (defun fibonacci-reader (n) (let ((i -1)