Lisp Stream API.
Aidan Kehoe
kehoea
Mon Nov 13 12:01:07 EST 2006
Ar an ceathr? l? d?ag de m? na Samhain, scr?obh stephen at xemacs.org:
> > Can someone explain to this no-formal-education-in-the-language Lisp user
> > why we don?t have (with-open-file ...) and the rest of the Common Lisp
> > stream API in XEmacs Lisp?
>
> Mostly hysterical raisins, I would guess. I suppose the main issue is
> that Emacs is an interactive text editor with a strong bias toward
> "slurp it ALL into an Emacs buffer and operate on it there". If you
> actually have an open I/O stream (pipe, network) then we do support
> those, with comint and so on, but in a quite different way from
> line-oriented streams (for example).
>
> > (insert-file-contents ...) with offsets doesn?t really cut it for
> > things like Perlish line processing.
>
> I don't understand what you mean by "Perlish line processing". The
> closest I can come up with is
>
> (progn
> (find-file "some/file")
> (while (not (eobp))
> (function-that-operates-on-a-line (point) (point-at-eol))
> (forward-line 1)))
>
> which demonstrates the "file-at-a-gulp" attitude. I suppose if you're
> really worried about memory usage you could do partial buffering with
> insert-file-contents as you mention, but the actual "read-line"
> function would still just be `forward-line'.
My problem is the memory usage, and my laptop?s tendency to overheat. For
example, I have a natural-language dictionary with each entry on a separate
line and I?m generating a .db index; the memory usage is stupid. The same
will be true for anyone working on Unihan.txt or big database dumps.
--
Santa Maradona, priez pour moi!
More information about the XEmacs-Beta
mailing list