Damian Conway wrote:

> :-)
> 
> I did consider that too, but the problem is that according to RFC 31 a
> C<yield> leaves the future entry point of a block at the next statement
> after the C<yield>, whereas the block needs to start from the beginning on
> each iteration.
> 
> Damian


Have you considered adding a C<map> example to RFC 31?  Yield would add
multiple output items per input item better IMO than the current practice
of accumulating a list of output items and returning it at the end.

        %newhash = map {yield $_; transform $somehash{$_}} @keysubset;

isn't any better than

        %newhash = map {($_,transform $somehash{$_})} @keysubset;

but you can certainly come up with a reasonable example.  Listing inventories
by department, for instance.  By yielding we would save the creation of the
per-iteration temporary and push directly onto the result.


-- 
                          David Nicol 816.235.1187 [EMAIL PROTECTED]
           perl -e'map{sleep print$w[rand@w]}@w=<>' ~/nsmail/Inbox

Reply via email to