Richard Heylen on Thu, 17 Oct 2013 21:42:53 +0200


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

Re: gp/pari version of the "Map" datatype and "reduce" function


I would strongly recommend that an initial value is passed in so that
the function is called once per element.  T

On 17 October 2013 19:12, Bill Allombert
<Bill.Allombert@math.u-bordeaux1.fr> wrote:
> On Thu, Oct 17, 2013 at 01:11:18PM -0400, Charles Greathouse wrote:
>> I think "fold" is good and avoids clashes.
>
> There is the question of associativity.
> I suggest we make it strictly less associative.
>
> However to answer Richard, lots of GP functions fold automatically, or
> there are variants that do:
>
> ? vecmax([1,2,3])
> %2 = 3
> ? gcd([4,6,9])
> %3 = 1
> ? factorback([1,2,3,4])
> %4 = 24
>
> Cheers,
> Bill.
>