summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-07-22 07:37:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-07-22 07:37:22 -0700
commit420a230dbae897ee32c03297f7e4bb18f683a8b1 (patch)
treeca542bbde5776b9a5f8ed5ecbd1769dc19956038 /txr.1
parentfb8a30d4540d04b02f98e7895cdb02d5c7f6c2e6 (diff)
downloadtxr-420a230dbae897ee32c03297f7e4bb18f683a8b1.tar.gz
txr-420a230dbae897ee32c03297f7e4bb18f683a8b1.tar.bz2
txr-420a230dbae897ee32c03297f7e4bb18f683a8b1.zip
Implementing second through tenth as places.
* eval.c (eval_init): Register second through tenth as intrinsic. * gencadr.txr: New cadr.c changes encoded. * lib.c (second, third, fourth, fifth, sixth): Functions reimplemented using ref, so they are much more efficient for vectors and strings. (seventh, eighth, ninth, tenth): New functions. * lib.h (seventh, eighth, ninth, tenth): Declared. * share/txr/stdlib/place.tl: place macros defined for second through tenth. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.141
1 files changed, 29 insertions, 12 deletions
diff --git a/txr.1 b/txr.1
index b6b952a8..53b90055 100644
--- a/txr.1
+++ b/txr.1
@@ -13713,26 +13713,43 @@ specifies the contents of the entire string or vector, as if the operation
were done on a non-empty vector or string, followed by the deletion of the
first element.
-.coNP Functions @, second @, third @, fourth @ fifth and @ sixth
+.coNP Accessors @, second @, third @, fourth @, fifth @, sixth @, seventh @, eighth @ ninth and @ tenth
.synb
-.mets (first << list )
-.mets (second << list )
-.mets (third << list )
-.mets (fourth << list )
-.mets (fifth << list )
-.mets (sixth << list )
+.mets (first << object )
+.mets (second << object )
+.mets (third << object )
+.mets (fourth << object )
+.mets (fifth << object )
+.mets (sixth << object )
+.mets (seventh << object )
+.mets (eighth << object )
+.mets (ninth << object )
+.mets (tenth << object )
+.mets (set (first << object ) << new-value )
+.mets (set (second << object ) << new-value )
+.mets ...
+.mets (set (tenth << object ) << new-value )
.syne
.desc
-These functions access the elements of a proper list by position.
-
-If the list is shorter than implied, these functions return
+Used as functions, these accessors retrieve the elements of a sequence by
+position. If the sequence is shorter than implied by the position, these
+functions return
.codn nil .
+When used as syntactic places, these accessors denote the storage locations
+by position. The location must exist, otherwise an error exception results.
+The places support deletion.
+
+
.TP* Examples:
.cblk
(third '(1 2)) -> nil
- (second '(1 2)) -> 2
- (third '(1 2 . 3)) -> **error**
+ (second "ab") -> #\eb
+ (third '(1 2 . 3)) -> **error, improper list*
+
+ (let ((x (copy "abcd")))
+ (inc (third x))
+ x) -> "abce"
.cble
.coNP Functions @, append @ nconc and @ append*