Bill Allombert on Thu, 07 Sep 2023 20:12:19 +0200


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

Re: bug in simplify_shallow


On Sun, Aug 27, 2023 at 04:13:54PM +0200, Karim Belabas wrote:
> * Ruud H.G. van Tol [2023-08-27 15:42]:
> > 
> > On 2023-08-27 14:58, Bill Allombert wrote:
> > > [...]to be honest I did not remember that listput returned x and it is
> > > not explicitly documented
> > 
> > ? ??listput
> > listput( list,x,{n}):
> > 
> >    Sets the n-th element of the list list (which must be of type t_LIST)
> > equal to x. If n is omitted, or greater than the list length, appends x. The
> > function returns the inserted element.
> > 
> > So "returns the inserted element".
> 
> What "the inserted element" means is ambiguous in the context of PARI's
> memory model. What the implementation does is return a direct pointer to
> the new list entry, that inserted element being a clone of the input x.

Whuch makes sense in the context of libpari, but for GP, it is better
not to return anything.

Cheers,
Bill