Singular
https://www.singular.uni-kl.de/forum/

Question about "nameof"
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1680
Page 1 of 1

Author:  georgm [ Fri Aug 08, 2008 1:19 pm ]
Post subject:  Question about "nameof"

Can anybody tell me what is wrong with the following code?
Code:
ring r = 0,(x,y,z),dp;
string s = nameof(basering);
setring s;

In other words, I try to grab the name of my basering into s, and want to switch to this ring later. How should I get this to work? Right now it tells me:
Code:
? s is no name of a ring/qring
? error occurred in STDIN line 14: `setring s; `

I strongly suspect this has worked for an old version of Singular (maybe 2.0).

Author:  Guest [ Fri Aug 08, 2008 8:33 pm ]
Post subject: 

It still works as before by writing

setring `s`;
> ring r=0,x,dp;
> string s = nameof(basering);
> // define another ring
> ring r2 = real,x,dp;
> basering;
// characteristic : 0 (real)
// number of vars : 1
// block 1 : ordering dp
// : names x
// block 2 : ordering C

> back to the previous ring
> setring `s`;
> basering;
// characteristic : 0
// number of vars : 1
// block 1 : ordering dp
// : names x
// block 2 : ordering C



Another possibility is to use:

def d = basering;

setring d;

Author:  georgm [ Sat Aug 09, 2008 10:37 am ]
Post subject: 

Thanks a lot, that worked!

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/