Opened 13 years ago

Last modified 13 years ago

## #205 new proposed feature

# some SINGULAR language suggestions

Reported by: | Owned by: | ||
---|---|---|---|

Priority: | major | Milestone: | 3-1-1 |

Component: | dontKnow | Version: | 3-1-0 |

Keywords: | language interpreter | Cc: |

### Description

Here are a couple of language-suggestions.

Indexed variables =================

It should be possible to create a ring whose variables are indexed with any arbitrary immutable type. Furthermore, it should be possible create an indexed set of variables where the index-set is any immutable type. Suggested syntax is below.

The following creates a ring with anonymous variables, i.e. variables must be accessed through the member 'vars' of the ring-object.

L = [(0,1,3)] * List (or any iterable object) with indices of ring-variables
R = ring (0,L)
R.vars[(0,1,3)] * Variables indexed by a tuple
R.vars[0,1,3] * Syntactic sugar -- same meaning as [(0,1,3)]
*

The following creates named variables from the variables of a ring:
x = R.vars
x[0,1,3] * Same as R.vars[0,1,3]
*

One could also assign specific variables
x = R.vars[(0,1,3)]
x * Same as R.vars[0,1,3]
*

The following is syntactic sugar for the declaration above. It creates a ring
with named variables at the same time
L = [0, 1, 2, 3] * Now variables are indexed by a single integer
R = ring (0,(x[L], y[L]))
x[0] * Both ring-elements
y[2]
R.vars[x][0] * Same as x[0]
*

The usual syntax ring (0, (x,y,z)) should also work
R = ring (0, (x,y,z))
x * All ring-elements
y
z
R.vars[x] * Same as x

The syntax R.vars[...] will be extremely useful when writing packages whose procedures work with multiple rings simultaneously. For example:

R = ring (0, (x,y,z))
x * Element of R
S = ring (0, (x,y))
x * Element of S
R.vars[x] * Element x of R
*

Strictly speaking, the syntax should be R.varsx?, but that is a bit cumbersome and it should be possible to make the syntax R.vars[x] work.

Grading =======

It should be possible to specify degrees of generators not just with a weight-vector but with a function which assigns a degree to each index in the index-set.

def degree (I):

* Cartesian cross-product of iterables L1 and L2
def product (L1, L2):
*

for x in L1:

for y in L2:

yield (x, y)

idx = product ([0, 3, 4] + range (6, 14), range (1, 4))

R = ring (0, x[idx], wp(degree)) * Degrees given by function degree
*

It should be possible to have a degree-function which returns multidegrees as well.

**Note:**See TracTickets for help on using tickets.