[CM] Confused about subvectors

Tito Latini tito.01beta at gmail.com
Wed Mar 17 01:47:44 PDT 2021


On Tue, Mar 16, 2021 at 10:06:01PM -0700, Iain Duncan wrote:
> Hi folks, not sure if I can't read or what, I'm trying to make subvectors
> and I'm not getting at all what I'm expecting from the docs. I thought from
> the s7 docs that subvector should return a vector given (subvector vector
> start end), or (subvector vector start end dimensions)
> 
> If anyone can shed some light on this, that would be lovely.
> iain
> 
> Here's my repl output from using the s7 repl example
> 
> > (define v (vector 1 2 3 4))
> #(1 2 3 4)
> > v
> #(1 2 3 4)
> > (subvector v 0 2)
> #()
> > (subvector v 0 2 1)
> 
> ;subvector: too many arguments: (#(1 2 3 4) 0 2 1)
> 
> > (subvector v)
> 
> ;subvector: not enough arguments: (#(1 2 3 4))

It works here (tested with Snd 21.2 and s7 9.9):

(define v (vector 1 2 3 4))
; => #(1 2 3 4)

(subvector v 0 2)
; => #(1 2)

(subvector v 0 4 '(2 2))
; => #2d((1 2) (3 4))


More information about the Cmdist mailing list