On Fri, Jan 29, 2016 at 5:00 AM, John Cowan <xxxxxx@mercury.ccil.org> wrote:

> > But should the map function return lists or ideques?  It seems heavyweight
> > to return ideques that are then just copied and discarded, whereas
> > returning lists seems inconsistent.  That's why I left this out.
>
> I'm thinking of rerturning ideque.  It's (ideque-filter values (ideque-map
> proc ideque ...))
> but saves creating intermediate ideque.

Correct, but does the 'proc' return a list or an ideque?  It has to
return some intermediate sequence data structure, since the whole point
of map-append is for one-to-many mappings.  Returning an ideque is more
consistent, but returning a list is cheaper.

It's filter-map; proc doesn't need to return a list or an ideque.  e.g.

(ideque->list (ideque-filter-map (lambda (x) (and (odd?  x) x)) (ideque 1 2 3 4 5)))
 => (1 3 4)