Search code examples
maple

print op(0, expr) without proc()


If I do this

z:=factor(randpoly(x)): 
op(0,z);

then I get nice result + (or * or ^ when polynomial z is reducible over Q). But if I do this

for i from 1 to 1 do
  z:=factor(randpoly(x)):
  print(op(0,z));
end do:

then I see this

proc () option builtin = `+`; end proc

Is there a way to print just the +, i. e. without proc()?


Solution

  • You're seeing print of the assigned value of the global name +.

    You could instead use the following (which also prints it as an unevaluated name),

    print(convert(op(0,z),`local`));
    

    or,

    print(convert(op(0,z),string))