[concurrency-interest] jsr166y IndexedProcedure ?

David J. Biesack David.Biesack at sas.com
Mon Aug 18 14:32:20 EDT 2008


Back in January, there was some discussion of the jsr166y
forkjoin/ParallelArray API. I had proposed the ability to pass the
element index to the procedure via a ParallelArray.apply. Doug replied

  "... the lack of an indexed-procedure version of apply is
   a bug; thanks for pointing it out! This will be added."

  http://cs.oswego.edu/pipermail/concurrency-interest/2008-January/004917.html
  http://cs.oswego.edu/pipermail/concurrency-interest/2008-January/004922.html

I've hit another case where this would be useful, so I'm just checking the status
of any API changes along these lines.

My use case: implementing ParallelDoubleArray.SummaryStatistics
and similar behaviors which do not mutate the ParallelDoubleArray.

I can't use summary() because I want new behavior: additional statistics
like variance and standard deviation, and pluggable value filtering;
i.e. do not include NaNs in size/sum/min/max/average.

I can't use a DoubleProcedure because I need the item index in order to
implement minIndex() and maxIndex().

I can use pda.replaceWithMappedIndex(Ops.IntAndDoubleToDouble) but that
performs extra work of assigning elements which I don't need. I'd like
to be able to reason about immutability, and replace* methods prevents
that.

-- 
David J. Biesack     SAS Institute Inc.
(919) 531-7771       SAS Campus Drive
http://www.sas.com   Cary, NC 27513


More information about the Concurrency-interest mailing list