> 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;

I can see what you're attempting, and it's a cool idea. But your
semantics are a little screwy in the above example. What you want is:

        %newhash = map {yield $_; transform($_)} %oldhash;

This flattens the %oldhash to a sequence of key/value pairs. Then the
first time the map block is called (i.e. on a key) it immediately
returns the key. The second time, it resumes after the C<yield> and
transforms the value. That resets the block so that for the next
iteration (another key) it returns at once, then tranforms the second
value, etc., etc.

I'll definitely add *that* in to RFC 31.

Thanks

Damian

Reply via email to