[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dope vector

This page is part of the web mail archives of SRFI 58 from before July 7th, 2015. The new archives for SRFI 58 contain all messages, not just those from before July 7th, 2015.



 | Date: Tue, 4 Jan 2005 18:21:49 -0800 (PST)
 | From: bear <bear@xxxxxxxxx>
 | 
 | On Tue, 4 Jan 2005, Bradd W. Szonye wrote:
 | 
 | Thus, our 5x4x3x2 array could be written
 | 
 | #5*4*3*2A(...)
 | or
 | #5*4*3*2A<typespec>(...)
 | 
 | or similar.  I think this is better enough in terms of being able
 | to express zero-size dimensions, enhanced human-readability and
 | maintainability that I wouldn't object to the increased
 | verbosity. It is not compatible with the CL prior art, but makes up
 | for it by being dog-easy to understand.

It does look readable.  There are several variations possible:

#<dim1>*<dim2>*...A (...)	        #2*3A ((a b c) (d e f))
#<dim1>*<dim2>*...A:<type> (...)	#2*3A:fixi-8 ((-1 0 1) (1 0 1))

#A<dim1>*<dim2>*... (...)		#A2*3 ((a b c) (d e f))
#A<dim1>*<dim2>*...:<type> (...)	#A2*3:fixn-16 ((2 0 1) (5 4 2))

#<rank>A<dim1>*<dim2>*... (...)		#2A2*3 ((0 1 2) (d e f))
#<rank>A<dim1>*<dim2>*...:<type> (...)	#2A2*3:fixn-8 ((0 1 2) (3 4 5))

#<rank>A (...)				#2A ((a b) (c d))
#<rank>A:<type> (...)			#2A:fixi-16 ((-1 0) (0 1))

Notice that all but the first example pair are unambiguous with each
other; and Common-Lisp arrays would be compatible when input.  For
output, one of the middle forms would be used.

 | >Specifying the dimensions also permits a convenient shorthand for
 | >repetitive arrays: If there aren't enough elements for a
 | >dimension, simply repeat the last element. For example, #100(1) is
 | >shorthand for #(1 1 1 1 ... 1)
 | 
 | True that.  I think I like this idea better than the current
 | proposal.