emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: streams are cool, you could stream virtually anything!


From: Michael Heerdegen
Subject: Re: streams are cool, you could stream virtually anything!
Date: Thu, 05 Nov 2015 17:48:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

raman <address@hidden> writes:

> I dont like stream-pop because users might then expect there to be a
> stream-push --- which might cause confusion.

Actually I plan a `stream-push' - why not?  There is nothing wrong with
that; `push' itself doesn't modify any list, it just sets the PLACE to
the newly created cons
  
  (cons NEWELT PLACE)

We can do the very same for streams; just use `stream-cons' instead of
`cons':

--8<---------------cut here---------------start------------->8---
(defmacro stream-push (newelt place)
  "Add NEWELT to the stream stored in PLACE.
This is equivalent to (setf PLACE (stream-cons NEWELT PLACE))."
  `(cl-callf2 stream-cons ,newelt ,place))
--8<---------------cut here---------------end--------------->8---

Would that be ok?


Regards,

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]