diff options
-rw-r--r-- | lib.c | 2 | ||||
-rw-r--r-- | tests/012/seq.tl | 3 | ||||
-rw-r--r-- | tests/012/sort.tl | 3 | ||||
-rw-r--r-- | txr.1 | 34 |
4 files changed, 20 insertions, 22 deletions
@@ -13344,6 +13344,8 @@ val copy(val seq) return copy_buf(seq); case FUN: return copy_fun(seq); + case RNG: + return vec_seq(seq); case TNOD: return copy_tnode(seq); case CPTR: diff --git a/tests/012/seq.tl b/tests/012/seq.tl index 5d63fbf5..c831e6c5 100644 --- a/tests/012/seq.tl +++ b/tests/012/seq.tl @@ -1621,3 +1621,6 @@ (mtest [keep-if (lop find "aiueo") "vertebrate" : chr-toupper] "EEAE" [remove-if (lop find "aiueo") "vertebrate" : chr-toupper] "VRTBRT") + +(test + (copy 1..10) #(1 2 3 4 5 6 7 8 9)) diff --git a/tests/012/sort.tl b/tests/012/sort.tl index bca4a3d8..d08bce3a 100644 --- a/tests/012/sort.tl +++ b/tests/012/sort.tl @@ -96,3 +96,6 @@ (test [hist-sort-by upcase-str '("a" "b" "c" "a" "b" "a" "b" "a")] (("A" . 4) ("B" . 3) ("C" . 1))) + +(let ((*random-state* (make-random-state 0))) + (test (shuffle 1..10) #(4 1 7 6 2 8 3 5 9))) @@ -21585,6 +21585,10 @@ as if by: .mono .meti (copy-iter << object ) .onom +.coIP rng +.mono +.meti (vec-seq << object ) +.onom .RE .IP @@ -21593,7 +21597,7 @@ For all other types of the invocation is erroneous. Except in the case when -.meta sequence +.meta object is .codn nil , .code copy @@ -21601,27 +21605,13 @@ returns a value that is distinct from (not .code eq to) -.metn sequence . -This is different from -the behavior of -.mono -.meti >> [ sequence 0..t] -.onom -or -.mono -.meti (sub < sequence 0 t) -.onom -which recognize -that they need not make a copy of -.metn sequence , -and just return it. - -Note however, that the elements of the returned sequence may be -eq to elements of the original sequence. In other words, copy is -a deeper copy than just duplicating the -.code sequence -value itself, -but it is not a deep copy. +.metn object . +When the object is a sequence, +the elements of the returned sequence may be +.code eq +to elements of the original sequence. In other words, +.code copy +is not required to perform a deep copy. .SS* List Manipulation .coNP Function @ cons |