Standard Vectors and Pattern Matching
The polyadic function @v can be used to add elements to a vector or to create a vector. The vector
consisting of the numbers 1, 2 and 3 can be created by (@v 1 2 3 <>). The polyadicity is a syntactic
fiction maintained by the Shen reader. (@v 1 2 3 <>) is parsed as (@v 1 (@ v 2 (@v 3 <>))) exactly
in the manner of @p.
The semantics of @v is as follows: given (@v X Y), if Y is a standard vector of size N, then @v creates
and outputs a new vector V of size N+1 and places X in the first position of V, copying the ith element
of Y to the i+1th element of V.
Shen accepts pattern-matching using @v. The following function adds 1 to every element of a vector
(vector number) --> (vector number)
<> -> <>
(@v X Y) -> (@v (+ X 1) (add1 Y)))
(@v X Y) matches the Y to the tail of the vector - so that matching (@v X Y) to <1 2> matches Y to <2>
not 2. Note because @v uses copying, pattern-directed vector manipulation is non-destructive but slow.