From: Paul Rudin
Subject: mapcan for series
Date: 
Message-ID: <m3pugktg6s.fsf@cara.scientia.com>
I'm looking at doing some stuff with the series package (using the
implementation from sourceforge).

I've written a series analogue of mapcan - lets call it map-catentate:

(defun map-catentate (fn s)
  ...)

fn returns a series, and map-catenate returns the series obtained by
catenating together the series resulting from applying fn to elements
of s (in the obvious order).

The trouble is I haven't been able write a version that will
optimtize. ISTM that it should be possible to do this.

Can anyone show me how this can be done (or explain why it can't)?

TIA.

From: Tim Bradshaw
Subject: Re: mapcan for series
Date: 
Message-ID: <ey3ae7mj1tz.fsf@cley.com>
* Paul Rudin wrote:
> I'm looking at doing some stuff with the series package (using the
> implementation from sourceforge).

> I've written a series analogue of mapcan - lets call it map-catentate:

> (defun map-catentate (fn s)
>   ...)

> fn returns a series, and map-catenate returns the series obtained by
> catenating together the series resulting from applying fn to elements
> of s (in the obvious order).

Isn't this one of those cases that it can't optimize almost by
definition.  It's a long time since I looked at series, but I remember
that it relies on being able to do things in lock-step, but in this
case it really can't do that, because you are concatenating series
together?

Or maybe I am confused.

--tim
From: Paul Rudin
Subject: Re: mapcan for series
Date: 
Message-ID: <m3y9v1vc0e.fsf@cara.scientia.com>
>>>>> "Tim" == Tim Bradshaw <ยทยทยท@cley.com> writes:

 Tim> * Paul Rudin wrote:
 >> I'm looking at doing some stuff with the series package (using the
 >> implementation from sourceforge).

 >> I've written a series analogue of mapcan - lets call it
 >> map-catentate:

 >> (defun map-catentate (fn s) ...)

 >> fn returns a series, and map-catenate returns the series obtained
 >> by catenating together the series resulting from applying fn to
 >> elements of s (in the obvious order).

 Tim> Isn't this one of those cases that it can't optimize almost by
 Tim> definition.  It's a long time since I looked at series, but I
 Tim> remember that it relies on being able to do things in lock-step,
 Tim> but in this case it really can't do that, because you are
 Tim> concatenating series together?

Maybe it's just that I don't understand the warning messages. I don't
expect the evaluation of catenated series to be parallelized. So maybe
I should just need to add appropriate declarations to make the
warnings go away in this particular case.

I was under the impression that I was being warned about something
over and above this.

 Tim> Or maybe I am confused.

Probably not.