How can I model multi-vector arrays? ...

Discussion of Common Lisp
Post Reply
Posts: 8
Joined: Sun Jun 30, 2013 12:36 pm
Location: Mexico city

How can I model multi-vector arrays? ...

Post by starfleet » Sun Jun 30, 2013 12:50 pm

Greetings everyone,

I know this sounds very newbie... and it definitely is...

I need to define a type of 2D matrix of bits, of size mxn (m rows by n columns), that can be used, either as a vector of rows, or as a vector of columns ...

Common Lisp's ability to define bit sequences like #*011011 seems very memory efficient, and I think, maybe it must be defined as two shared (displaced) vectors, one as a vector of rows, and the other as a vector of columns, but I cannot make heads and tails about how to do it... :(

Maybe, I'm all wrong, and the best thing to do is define normal 2D matrices and provide an interface to handle row or column designations... What do you think?

Can someone please help??

Thanks in advance.

Posts: 226
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: How can I model multi-vector arrays? ...

Post by edgar-rft » Mon Jul 01, 2013 10:28 pm

A multi-dimensional bit-array with dimensions m x n can be created by using the Common Lisp MAKE-ARRAY function like this:

Code: Select all

(make-array '(m n) :element-type 'bit) => 2-dimensional bit-array
Look at Tamas K. Papp's array-operations for the implementation of many array functions.

- edgar

Post Reply