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

Re: [FD] utility of vector?



On Tue, 7 Mar 2000, Jason Trenouth wrote:
> On Tue, 7 Mar 2000 11:15:01 -0500 (EST), dauclair@hotmail.com wrote:
> 
> > So, the DRM says one can get a new vector with vector().  I tried it
> > ... obviously the size: and fill: keywords don't work.  So, if I
> > 
> > let row = make(<vector>,size: 120, fill: 0);
> > 
> > how do I do the same with the vector fn?
> 
> vector(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

Nonono, you write a new (non-mutable?) lazy <sequence> subclass which
contains N copies of some value V (or N concatenations of a sequence S?)
you supply in the call to make, then do something like

  apply(vector, make(<repeater-sequence>, size: 120, fill: 0), #[]);

;-)

Or maybe you could do it with macros ... ?  Answer: probably not, as you
can't do arithmetic -- or any other evaluation -- during macro expansion. 
OTOH, you could write a function macro which expanded to something like
your original call to make.  And, to be serious for a moment, that call to
"make(<vector>, ...)" is the best answer.

HTH,
Hugh




Follow-Ups: References: