Singular https://www.singular.uni-kl.de/forum/ |
|
overloading "[" operator for newstructs https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=2361 |
Page 1 of 1 |
Author: | Randolf [ Wed Mar 19, 2014 5:35 pm ] |
Post subject: | overloading "[" operator for newstructs |
Hello everyone, I am currently working on a package for handling arrangements of hyperplanes. I already managed to get the operators "+" and "=" working to my confidence, but I am still struggling with "[". So I want it to behave the same for our newstruct "arr" (which is basically a list) as it does for lists/ideals. With Code: system("install", "arr" , "[", arrGet ,2); I managed to get access, i.e. A[2]; returns me the second second hyperplane for an arrangement A.However I cannot figure out to overload this for assignement, i.e. that A[2] = h; would actually save h as the second hyperplane of my arrangement. So as far as I know in C one can do this like Code: public object this[int i] { get { return InnerList[i]; } set { InnerList[i] = value; } } Is there a way to do this in Singular, too? |
Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |