Singular Manual: printf

| ### 5.1.120 printf Procedure from library `standard.lib` (see standard_lib). Syntax: `printf (` string_expression `[,` any_expressions`] )` Return: none Purpose: `printf(fmt,...);` performs output formatting. The first argument is a format control string. Additional arguments may be required, depending on the content of the control string. A series of output characters is generated as directed by the control string; these characters are displayed (i.e., printed to standard out). The control string `fmt` is simply text to be copied, except that the string may contain conversion specifications. Type `help print;` for a listing of valid conversion specifications. As an addition to the conversions of `print`, the `%n` and `%2` conversion specification does not consume an additional argument, but simply generates a newline character. Note: If one of the additional arguments is a list, then it should be enclosed once more into a `list()` command, since passing a list as an argument flattens the list by one level. Example:
      ring r=0,(x,y,z),dp;
    module m=[1,y],[0,x+z];
    intmat M=betti(mres(m,0));
    list l=r,m,matrix(M);
    printf("s:%s,l:%l",1,2);
    ==> s:1,l:int(2)
    printf("s:%s",l);
    ==> s:(QQ),(x,y,z),(dp(3),C)
    printf("s:%s",list(l));
    ==> s:(QQ),(x,y,z),(dp(3),C),y*gen(2)+gen(1),x*gen(2)+z*gen(2),1,1
    printf("2l:%2l",list(l));
    ==> 2l:list("(QQ),(x,y,z),(dp(3),C)",
    ==> module(y*gen(2)+gen(1),
    ==> x*gen(2)+z*gen(2)),
    ==> matrix(ideal(1,
    ==> 1),1,2))
    ==>
    printf("%p",matrix(M));
    ==> 1,1
    printf("%;",matrix(M));
    ==> _[1,1]=1
    ==> _[1,2]=1
    ==>
    printf("%b",M);
    ==>            0     1
    ==> ------------------
    ==>     0:     1     1
    ==> ------------------
    ==> total:     1     1
    ==>
See also: fprintf; print; sprintf; string.

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