Max Alekseyev on Wed, 13 Mar 2024 18:58:41 +0100


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

Re: Avoid using "listput()" if possible?


Hi Bill,

Why is this explicit specification for the object reference required for listput()? What happens if ~ is missed?
It looks like functions that don't modify the object (like mapget()) implicitly work with references, with no need to specify ~. Please confirm.
I'm puzzled why there is such a discrepancy in the interface - I'd rather welcome an uniform interface where the reference either always has to be specified when used, or is always implied by particular functions without specifying it.

Regards,
Max


On Tue, Mar 12, 2024 at 6:56 PM Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote:
On Tue, Mar 12, 2024 at 09:06:22AM +0100, hermann@stamm-wilbrandt.de wrote:
> Yesterday I was happy to have working "SquaresRepresentations(n,k)" using
> "for(...foreach(...listput(..)))".
>
> ...
> for(b=a,m,foreach(SquaresRepresentations(n-b^2,k-1,b),s,listput(R,concat([b],s))));
>   Vec(R);
> }

If you use listput, please write listput(~R,...)

Cheers,
Bill.