Singular Manual: apply

  | ### 5.2.1 apply `Syntax:` `apply(` expression `,` function `);` `Purpose:` applies the function to all elements of the first argument. The first argument must be of type `intvec`, `intmat`, or `list`. The result will be an expression list, its type and format will be set by the following assign. The function must be a kernel command or a procedure which takes one argument and returns a a value. `Example:`
      proc p(int x) {return(x^2);}
      intvec v=1,2,3;
      apply(v,p);
      ==> 1 4 9
      intvec vv=apply(v,p);vv;
      ==> 1,4,9
      list ll=apply(v,p);ll;
      ==> [1]:
      ==>    1
      ==> [2]:
      ==>    4
      ==> [3]:
      ==>    9

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