[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Idea on how to implement named ranges in Siag
I was thinking of a way to implement named ranges in Siag that would
be an improvement in what I've seen in spreadsheets so far. I'm not
sure if any of the ideas in this e-mail are new. I know some of them
are old and already done in other spreadsheets; as for the rest, they
may or may not be original, but anyhow they seem like good ideas.
Say you have a range of numbers in the range r1c1..r7c2 like this:
1 2
3 4
5 6
7 8
9 10
11 12
13 14
Now in a typical spreadsheet, I can set the block to cover r1c1..r7c2
and give this block of numbers a name; call it 'foo'. I'd like to see
Siag do this. There's more though.
Rather than have the name 'foo' refer to the range of cells
r1c1..r7c2, I would rather have 'foo' refer to an array foo internally
stored in Siag with 7 rows and 2 columns with the elements foo(1,1)=1,
foo(2,1)=2, foo(1,2)=3, etc. (foo(i,j) is supposed to refer to the
element in row i and column j of foo.) This array would henceforth
exist independently of the numbers in r1c1..r7c2; after foo was
created and internally stored, the numbers in r1c1..r7c2 could even be
deleted.
Okay, now that array 'foo' is created, what to do with it? Well, one
could create an instance of it on the worksheet, say for example, by
typing the name foo in cell r3c5, which would cause the the array foo
to appear in the cells r3c5..r9c6. This instance of foo could be said
to be 'anchored' at r3c5. I could create another instance of foo
anchored at r1c10, or r6c6, etc. Each of these instances would be an
exact reproduction of the name 'foo'.
I need to be able to do two other things with foo: be able to edit the
elements of foo and use elements of foo in formulas.
foo could be edited perhaps by clicking on a menu option that brings
up a window containing a mini-spreadsheet with all the elements of foo
in it. Here the elements of foo could be edited, which of could would
effect all instances of foo. New rows or columns could be added to foo
as well. I'm not married to this particular way of editing foo, but
offhand it sounds like a good idea.
Elements of foo could be retrieved for use in formulas with functions
maybe like these:
get_element(foo, <row in foo>, <column in foo>), for a C expression.
(get-element foo (<row in foo> <column in foo>)), for a SIOD expression.
Simply using numbers for the coordinates <row in foo> and <column in
foo> would probably be kind of rigid, so I think this scheme should be
modified a bit. Here's a way I think this could be done:
Create a empty array by setting a block of empty cells; name it 'bar'.
Ideally, this empty array should have the same dimensions as array
foo. Now the following (SIOD) functions could be entered into bar:
(get-element foo (<row in foo> corresp))
(get-element foo (corresp <column in foo>))
(get-element foo (corresp corresp))
The expression 'corresp' would mean to use the row or column of foo
that corresponds to the row or column or column of bar. For example,
if bar(2,1) were to contain
(get-element foo (1 corresp))
that would mean to get the element foo(1,1). If bar(2,1) were to contain
(get-element foo (corresp 3))
that would mean to get the element foo(2,3). If the element bar(2,1)
were to contain
(get-element foo (corresp corresp))
that would mean to get the element foo(2,1). 'corresp' could obviously
only work inside an array, which is why one had to create an empty
array called 'bar'.
The basic idea here is to have a way to reference data without having
to depend on the particular position of cells with respect to the
grid. One could move things about more easily without having to worry
about throwing calculations out of whack. This would seem to be a more
robust way to do data manipulation.
Again, I don't know if these ideas are original or not, but they
seemed like good ones, and no one else brought them up. See what you
think.
--J. J.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com