gap system - How to print to textfile in GAP without linebreaks? -


minimum working example

x:=indeterminate(rationals,"x"); f:=sum([1..1000],i->x^i); printto("~/temp.txt",f); 

it prints temp.txt following:

x^1000+x^999+x^998+x^997+x^996+x^995+x^994+x^993+x^992+x^991+x^990+x^989+x^988\ +x^987+x^986+x^985+x^984+x^983+x^982+x^981+x^980+x^979+x^978+x^977+x^976+x^975\ +x^974+x^973+x^972+x^971+x^970+x^969+x^968+x^967+x^966+x^965+x^964+x^963+x^962\ +x^961+x^960+x^959+x^958+x^957+x^956+x^955+x^954+x^953+x^952+x^951+x^950+x^949\  [snip] 

how can instead print on single line in text file?

that's common need, , solution called setprintformattingstatus. see its documentation online or type ?setprintformattingstatus in gap prompt see documentation.

note have use streams in case, not work text files straightforwardly. outputtextfile (documented after setprintformattingstatus) need use.

in example above, use

x:=indeterminate(rationals,"x"); f:=sum([1..1000],i->x^i); output := outputtextfile( "poly", false );; setprintformattingstatus(output, false); printto(output,f); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -