Title
h

Hullaballoonatic

05/02/2019, 7:25 PM
i can see why it might not exist because it could be conflated with
subList
since they both take two `Int`s as params.
r

Ruckus

05/02/2019, 7:26 PM
And considering the "workaround" is (as you demonstrated) extremely simple.
h

Hullaballoonatic

05/02/2019, 7:27 PM
It's just a more pragmatic approach to sublists in the context of vectors
1
vectors are basically arrays, but mathematically they are determined by a point, an angle, and a length, and so operations on them in math are based on that length. so a vector class would be like a list, but its contents would be generated based on a variable length, and you wouldn't be able to alter the contents therein directly. In a perfect world where truly immutable collections existed
so if you're doing operations with vectors and you just want to perform arithmetic with a portion of an existing vector, you could use
subVector
, as I proposed instead of constantly instantiating new objects.
that's the thought process at least
r

Ruckus

05/02/2019, 8:05 PM
I think some of your assumptions are flawed, but that's neither here nor there. In computer science, a vector is just another term for a list or an array (they're all roughly synonymous, but each language defines their own nuance around them).
h

Hullaballoonatic

05/02/2019, 8:05 PM
yeah, there's always been a clash between programming syntax and mathematical syntax
r

Ruckus

05/02/2019, 8:08 PM
...a list, but its contents would be generated based on a variable length...
How do you expect to do indexed operations on generated data?
Also
...mathematically [vectors] are determined by a point, an angle, and a length...
I think you're confusing representation and definition. That is just a representation of the vector, and it's just as valid to represent it using starting and ending coordinates (and is often quite useful as it allows for easy matrix operations).
h

Hullaballoonatic

05/02/2019, 8:12 PM
you're right!
r

Ruckus

05/02/2019, 8:13 PM
I don't mean to nit-pick, but I think it is relevant in this case as the difference in method signatures is just that (a choice between representation with magnitude or with end position)