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

Re: Initial value for unfold(-right)

This page is part of the web mail archives of SRFI 117 from before July 7th, 2015. The new archives for SRFI 117 contain all messages, not just those from before July 7th, 2015.



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: ktakashi@xxxxxxxxx