Groups | Search | Server Info | Login | Register
Groups > comp.lang.lisp > #60737
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | luxhalitus <luxhalitus@null.invalid> |
| Newsgroups | comp.lang.lisp |
| Subject | Connecting stream filters in CL |
| Date | Wed, 05 Nov 2025 10:18:44 +0000 |
| Organization | A noiseless patient Spider |
| Lines | 41 |
| Message-ID | <8qgkeq9n.fsf@null.invalid> (permalink) |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Date | Wed, 05 Nov 2025 10:18:45 +0000 (UTC) |
| Injection-Info | dont-email.me; posting-host="1aa71da79315a6c1b3b91c1f7543167f"; logging-data="336537"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DG/yDv3i7gDjq+9Fmdxgn06pEV8hglq4=" |
| User-Agent | Gnus/5.13 (Gnus v5.13) |
| Cancel-Lock | sha1:9SxR09CS2yA84nO1T5ffqJzhuQk= sha1:aEGIetj2vIL+cNg3XpULRaXnuXo= |
| Xref | csiph.com comp.lang.lisp:60737 |
Show key headers only | View raw
I'm currently prototyping a system of multiple interconnected string filters and am wondering what the best practices are regarding the Common Lisp streams API. If i had a filter function like: | (defun number-lines (in out) | (handler-case | (loop with line = "" | and number = 1 | do (setf line (read-line in)) | (format out "~D: ~A" number line) | (incf number)) | (end-of-file (e)))) how would i go about chaining two calls together? A macro that takes advantage of the string stream types immediately comes to mind: | (defmacro pipe ((writing &body in) (reading &body out)) | `(let ((,reading | (make-string-input-stream | (let ((,writing (make-string-output-stream))) | ,@in | (get-output-stream-string ,writing))))) | ,@out)) You could also write wrappers around C pipe(2) or mkfifo. None of these seem like such a good fit for Common Lisp streams though, considering their implementation should already come with some kind of buffering built in. Allegro CL exposes a make-pipe-streams and a make-function-input-stream function, but no such luck in SBCL it seems. Any quicklisp packages featuring this exact functionality or alternatives i'm missing? -- ,`> ( ( `.>
Back to comp.lang.lisp | Previous | Next | Find similar
Connecting stream filters in CL luxhalitus <luxhalitus@null.invalid> - 2025-11-05 10:18 +0000
csiph-web