Bill Allombert on Tue, 25 Nov 2014 23:33:32 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: New gp function fold()


On Tue, Nov 25, 2014 at 05:08:14PM -0500, Charles Greathouse wrote:
> Yes, that's precisely what I mean, Loïc.
> 
> > This is mostly useful for multiplication, and factorback() and lcm()
> already
> > handles this case. Do you have other examples ?
> 
> An obvious example would be chinese(). 

This is already available for chinese, just do chinese(V)!

> But anywhere partial results are
> large this function could be useful. One eventual application would be
> parallelization -- if you've already told gp that the operation is
> associative, and nbthreads > 1, it could split the calculation onto two or
> more cores. (I'm not suggesting that we implement this now -- but having it
> in the language would make it easier to do this in the future, which may be
> useful as the number of cores rise.)

But then this would be parfold(). Together with parapply(), we would have
something similar to map/reduce.

Cheers,
Bill.