Ruud H.G. van Tol on Mon, 25 Dec 2023 17:46:44 +0100


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

reference parameters


<>
? ??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.

   ? 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?

-- Ruud