summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2024-10-01 13:38:15 -0700
committerKaz Kylheku <kaz@kylheku.com>2024-10-01 13:38:15 -0700
commit8eeaeb95154d868b9fd201ff9cbf88b1031921cc (patch)
tree3889a2c1beccf43ee7568462e782a7909f78a3a5 /txr.1
parente46abe3ec8b59826842dd5cc9ac3b5381240ec95 (diff)
downloadtxr-8eeaeb95154d868b9fd201ff9cbf88b1031921cc.tar.gz
txr-8eeaeb95154d868b9fd201ff9cbf88b1031921cc.tar.bz2
txr-8eeaeb95154d868b9fd201ff9cbf88b1031921cc.zip
copy: now handles range objects.
Ranges are iterable, denoting abstract sequences. The copy function now copies a range by constructing the array. This is useful when copy is used for the purpose of obtaining a mutable copy. For example, (shuffle 0..100) will now work, returning a shuffled vector of the integers from 0 to 99. * lib.c (copy): Handle RNG case via vec_seq. * tests/012/seq.tl, * tests/012/sort.tl: New test cases. * txr.1: Documented. Documentation for the copy function improved.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.134
1 files changed, 12 insertions, 22 deletions
diff --git a/txr.1 b/txr.1
index 128fcebf..5f888d4f 100644
--- a/txr.1
+++ b/txr.1
@@ -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