VectorCore

By Andrew Owen
Released under the MIT license

Notes:

Words for creating and manipulating vectors

vec-set-at ( vec val idx -- elem )

Set vector at idx to value

vec-at ( vec idx -- elem )

Get element at index

<vector> ( -- vector )

Init a new vector

vec-each ( vec quot -- .. )

Run `quot` for each element in the vector

vec-append ( vec elem -- vec )

Push elem to the end of vec, leaving vec on the stack

vec-push ( vec elem -- )

Push elem to the end of vec, taking vec off the stack

vec-pushback ( vec elem -- )

Same as vec-push

vec-prepend ( vec elem -- vec )

Push elem to the front of vec, leaving vec on the stack

vec-popback ( vec -- vec elem )

Pop elem of the end of vec, leaving both on the stack

vec-popfront ( vec -- vec elem )

Pop elem off the front of vec, leaving both on the stack

2vector ( a b -- vec )

1st ( vec -- elem )

2nd ( vec -- elem )

3rd ( vec -- elem )

4th ( vec -- elem )

5th ( vec -- elem )

6th ( vec -- elem )

each2 ( v1 v2 quot [ a b -- ab ] v3 )

splat ( vec -- items... )

vec-reverse ( vec -- reversevec )

vec-filter ( vec quot -- filteredVec )

vec-map ( vec quot -- mappedVec )

vec-dropfront ( vec -- newvec )

vec-dropback ( vec -- newvec )