Changeset 7c19ec8 in git
- Timestamp:
- Dec 2, 2019, 2:32:37 PM (4 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 0687a7c00b5eb5b502bf85fbd217273dae8935d7
- Parents:
- 4c740db8a56497af8a13d7d7ef781de902adb671
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/general.lib
r4c740d r7c19ec8 7 7 PROCEDURES: 8 8 A_Z(\"a\",n); string a,b,... of n comma separated letters 9 A_Z_L(\"a\",n); list of strings a,b,... of n letters 9 10 ASCII([n,m]); string of printable ASCII characters (number n to m) 10 11 absValue(c); absolute value of c … … 92 93 sR; 93 94 execute(sR); 95 R; 96 } 97 proc A_Z_L (string s,int n) 98 "USAGE: A_Z_L(\"a\",n); a any letter, n integer (-26<= n <=26, !=0) 99 RETURN: list of n small (if a is small) or capital (if a is capital) 100 letters, beginning with a, in alphabetical 101 order (or reverse alphabetical order if n<0) 102 EXAMPLE: example A_Z_L; shows an example 103 " 104 { 105 list l; 106 int ii; 107 if ( n>=-26 and n<=26 and n!=0 and size(s)==1) 108 { 109 string alpha = 110 "abcdefghijklmnopqrstuvwxyz"+ 111 "abcdefghijklmnopqrstuvwxyz"; 112 int aa=find(alpha,s); 113 if (aa==0) 114 { 115 alpha = 116 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+ 117 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 118 aa=find(alpha,s); 119 } 120 if (aa>0) 121 { 122 if (n>0) 123 { 124 for(ii=aa; ii<aa+n; ii++) { l=l+list(alpha[ii]); } 125 return(l); 126 } 127 else 128 { 129 aa=aa+26; 130 for(ii=aa; ii>aa+n; ii--) { l=l+list(alpha[ii]); } 131 return(l); 132 } 133 } 134 else 135 { ERROR(s+" sis not a letter");} 136 } 137 if (s[2]=="(") 138 { 139 for(ii=1;ii<=n;ii++) 140 { 141 l=l+list(s+string(ii)+")"); 142 } 143 return(l); 144 } 145 } 146 example 147 { "EXAMPLE:"; echo = 2; 148 A_Z_L("c",5); 149 A_Z_L("Z",-5); 150 ring r; 151 list L=list(0,A_Z_L("A",6),list(list("dp",1:6),list("C",0)),ideal(0)); 152 ring R=ring(L); 94 153 R; 95 154 }
Note: See TracChangeset
for help on using the changeset viewer.