[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ANN] New library stream.el in ELPA
From: |
Michael Heerdegen |
Subject: |
Re: [ANN] New library stream.el in ELPA |
Date: |
Sat, 24 Oct 2015 21:16:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Nicolas Petton <address@hidden> writes:
> The generic `stream' function currently accepts lists, strings, arrays
> and buffers as input, but it can be cleanly extended to support pretty
> much any kind of data.
I have a question: For implementing the diverse generic seq functions
(`seq-p', `seq-elt', `seq-length') for streams you use `cl-defgeneric'
all the time, e.g.
--8<---------------cut here---------------start------------->8---
(cl-defgeneric seq-elt ((stream stream) n)
"Return the element of STREAM at index N."
(while (> n 0)
(setq stream (stream-rest stream))
(setq n (1- n)))
(stream-first stream))
--8<---------------cut here---------------end--------------->8---
But according to the doc of `cl-defgeneric' and `cl-defmethod', this
seems the perfect use case for `cl-defmethod':
"[...] it defines the implementation of NAME to use for invocations where
the value of the dispatch argument matches the specified TYPE."
So why do you use `cl-defgeneric' - what do I miss?
Regards,
Michael.
- Re: [ANN] New library stream.el in ELPA, (continued)
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/20
- Re: [ANN] New library stream.el in ELPA, Jay Belanger, 2015/10/20
- Re: [ANN] New library stream.el in ELPA, David Kastrup, 2015/10/20
- Re: [ANN] New library stream.el in ELPA, Nicolas Petton, 2015/10/23
- Re: [ANN] New library stream.el in ELPA, John Wiegley, 2015/10/23
Re: [ANN] New library stream.el in ELPA, Michael Heerdegen, 2015/10/15
Re: [ANN] New library stream.el in ELPA, John Mastro, 2015/10/15
Re: [ANN] New library stream.el in ELPA,
Michael Heerdegen <=