Singular Manual: reference and shared related functions

  | ### 4.28.6 reference and shared related functions `def` explicitly type casts to `reference` or `shared`, respectively. (Note: For the `def` declaration, see def.) Example:
      system("reference"); system("shared");
      int i =1;
      reference ref = i;
      shared sh = 17;
      list ll = list(ref, ref, ref, sh, sh);
      ll[1] = 2;      // replace only one entry
      ll;
      ==> [1]:
      ==>    2
      ==> [2]:
      ==>    1
      ==>
      ==> [3]:
      ==>    1
      ==>
      ==> [4]:
      ==>    17
      ==>
      ==> [5]:
      ==>    17
      ==>
      def(ll[2]) = 3;      // change the others
      ll;
      ==> [1]:
      ==>    2
      ==> [2]:
      ==>    3
      ==>
      ==> [3]:
      ==>    3
      ==>
      ==> [4]:
      ==>    17
      ==>
      ==> [5]:
      ==>    17
      ==>
      def(ll[4]) = 19;     // same here
      ll;
      ==> [1]:
      ==>    2
      ==> [2]:
      ==>    3
      ==>
      ==> [3]:
      ==>    3
      ==>
      ==> [4]:
      ==>    19
      ==>
      ==> [5]:
      ==>    19
      ==>
  `link` explicitly dereference a `reference` or `shared` object. (Note: For the `link` declaration, see link.) Example:
      system("reference"); system("shared");
      ring r = 0, (x,y,z), dp;
      poly p = x + y + z;
      def x_=x;
      reference xref=x_;
      xref;
      ==> x
      ==>
      subst(p, xref,1, y,2, z,3);        // fails
      ==>    ? subst(`poly`,`reference`,`int`) failed
      ==>    ? expected subst(`poly`,`poly`,`poly`)
      ==>    ? expected subst(`matrix`,`poly`,`int`)
      ==>    ? error occurred in or before ./examples/reference_and_shared_related_\
         functions_1.sing line 7: `subst(p, xref,1, y,2, z,3);        // fails`
      subst(p, link(xref),1, y,2, z,3);  // fine
      ==> 6
  `system` The `reference` and `shared` objects overload the `system` command to gain extended features, see `system(ref, "help")` for more details. (Note: For the general `system` command, see system.) Example:
      system("reference"); system("shared");
      shared sh;
      system(sh, "help");
      ==> system(<ref>, ...): extended functionality for reference/shared data <ref\
         >
      ==>   system(<ref>, count)         - number of references pointing to <ref>
      ==>   system(<ref>, enumerate)     - unique number for identifying <ref>
      ==>   system(<ref>, undefined)     - checks whether <ref> had been assigned
      ==>   system(<ref>, "help")        - prints this information message
      ==>   system(<ref>, "typeof")      - actual type referenced by <ref>
      ==>   system(<ref1>, same, <ref2>) - tests for identic reference objects

User manual for Singular version 4.3.2, 2023, generated by texi2html.