Email list hosting service & mailing list manager

Initial value for unfold(-right) John Cowan (10 Jan 2015 23:49 UTC)
Re: Initial value for unfold(-right) Takashi Kato (11 Jan 2015 11:39 UTC)
Re: Initial value for unfold(-right) Arthur A. Gleckler (11 Jan 2015 17:19 UTC)
Re: Initial value for unfold(-right) Takashi Kato (11 Jan 2015 18:44 UTC)
Re: Initial value for unfold(-right) Arthur A. Gleckler (11 Jan 2015 21:16 UTC)
Re: Initial value for unfold(-right) Takashi Kato (12 Jan 2015 06:14 UTC)
Re: Initial value for unfold(-right) Arthur A. Gleckler (12 Jan 2015 06:17 UTC)
Re: Initial value for unfold(-right) John Cowan (12 Jan 2015 13:27 UTC)

Re: Initial value for unfold(-right) Takashi Kato 11 Jan 2015 11:39 UTC

On 11/01/2015 00:49, John Cowan wrote:
> I got a private mail suggesting that list-queue-unfold(-right) should
> have an optional argument for a tail list-queue onto which the
> generated elements are prepended.  I thought about this earlier, but
> couldn't decide if it should be an initial queue (which would have to
> be copied for safety) or an initial list (where it's an error if you
> mutate the list later), so I left it out.
>
> Thoughts, anybody?
I don't quite get the idea so just to clarify. Does this mean if the
optional argument is given like this:
(list-queue-unfold (lambda (seed) (zero? seed))
                    (lambda (seed) (* seed seed))
                    (lambda (seed) (- seed 1))
                    10
                    '(a b c))
Then the queue storage would look like this?
(100 81 64 49 36 25 16 9 4 1 a b c)

If this is the case, I think it's rather weird. I would expect that all
elements have the same type (or at least the types mapper procedure
returns). But if the procedures are allowed to take the tail elements,
this expectation would be broken.

Cheers,

--
_/_/
Takashi Kato
E-mail: xxxxxx@ymail.com