lisp question

I have a need for a matrix structure in lisp. I'm having trouble defining how to handle this using lisp. The problem is:
I have a list (X Y) which make up a matrix (M) with indices i & j. I and J are unknown quantities before run time. The matrix dimension of i x j is in excess of 10000. I must be able to both add values to the end of the column and retrieve columns of values to this structure. For example
M | 1 2 3 4 5 6 7 --------------- 1 | 1 4 X 8 9 1 3 2 | 1 1 3 4 4 5 3 | 2 3 5 5 4 2 4 | 2 2 2 2 X 2 5 | 1 3 X X 0 6 | 0 X X 7 | X
Need to a save item to the end (or beginning) of any column (where X's are shown) and need to retrieve the whole column (not individual items).
Does anyone have an idea of how to handle this? I mentioned the dimension of the Matrix so you have an understanding that the structure must be fast. I cannot rebuild the list each time I add an item.
My best plan to handle this was to use j+1 lists. There would be one list for each column plus an index list holding the names of the lists. For example the columns would be named and in a list like this (col1 col2 col3...) Where col1 was the var that pointed to the list. Then to add to a list look-up the var then evaluate the name and cons a new item to the list. To retrieve just look-up the name. My problem here is I cannot figure out how to generate the lists names (col1 etc) dynamically. (I don't know the number of columns until run time.)
Any help would be appreciated.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
HiHO; Bill Kramer addressed this in June &July 93 Cadalyst mag. It can also be found in his "Autolisp Treasure Chest". I think one may still reach him at cadalyst.com

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
gjs wrote:

That could work.

Here's how you could do it in Common Lisp (sorry, I don't have an AutoLisp reference handy, but hopefully this will give you some ideas):
D++(20): (setq test '((1 1 2 2 1 0) (4 1 3 2 3) () (8 3 5 2) (9 4 5 2) (1 4 4) (3 5 2 2 0))) ((1 1 2 2 1 0) (4 1 3 2 3) NIL (8 3 5 2) (9 4 5 2) (1 4 4) (3 5 2 2 0))
D++(21): (third test) NIL
D++(22): (push 6 (third test)) (6)
D++(23): test ((1 1 2 2 1 0) (4 1 3 2 3) (6) (8 3 5 2) (9 4 5 2) (1 4 4) (3 5 2 2 0))
D++(24): (push 4 (third test)) (4 6)
D++(25): (setf (third test) (append (third test) (list 5))) (4 6 5)
D++(26): test ((1 1 2 2 1 0) (4 1 3 2 3) (4 6 5) (8 3 5 2) (9 4 5 2) (1 4 4) (3 5 2 2 0))
D++(27): (pprint test) ((1 1 2 2 1 0) (4 1 3 2 3) (4 6 5) (8 3 5 2) (9 4 5 2) (1 4 4) (3 5 2 2 0))
D++(28): (push 10 (nth 6 test)) (10 3 5 2 2 0)
D++(29): (pprint test) ((1 1 2 2 1 0) (4 1 3 2 3) (4 6 5) (8 3 5 2) (9 4 5 2) (1 4 4) (10 3 5 2 2 0))
D++(30): (setf (nth 6 test) (append (nth 6 test) (list 11))) (10 3 5 2 2 0 11)
D++(31): (pprint test) ((1 1 2 2 1 0) (4 1 3 2 3) (4 6 5) (8 3 5 2) (9 4 5 2) (1 4 4) (10 3 5 2 2 0 11))
NOTE: the D++(xx): are my command line prompts.
HTH,
--
Bill Cochell

"The man who is a pessimist before forty-eight knows too much;
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.