Re: reference parameters
Bill Allombert <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.devel |
|---|---|
| Message-ID | <ZYnLIv7DMquNtA+J@seventeen> |
On Mon, Dec 25, 2023 at 05:46:37PM +0100, Ruud H.G. van Tol wrote:
> ? ??listput
> listput( list,x,{n}):
Not that this is a bug in the doc generator, the fixed version outputs
listput(~list,x,{n}):
(~ is an unbreakable space in TeX).
> Â Â 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.
>
> Â Â ? L = List();
> Â Â ? listput(~L, 1)
> Â Â %2 = 1
> Â Â ? listput(~L, 2)
> Â Â %3 = 2
> Â Â ? L
> Â Â %4 = List([1, 2])
>
> Note the ~ L: this means that the function is called with a reference to L
> and changes L in place.
>
> Is that explicit reference notation still relevant?
Why not ?
We allow to omit the "~" for backward compatibility only.
This is mandatory for user-defined functions, because GP functions
are not prototyped.
Cheers,
Bill.