diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-07-22 07:37:22 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-07-22 07:37:22 -0700 |
commit | 420a230dbae897ee32c03297f7e4bb18f683a8b1 (patch) | |
tree | ca542bbde5776b9a5f8ed5ecbd1769dc19956038 /txr.1 | |
parent | fb8a30d4540d04b02f98e7895cdb02d5c7f6c2e6 (diff) | |
download | txr-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.1 | 41 |
1 files changed, 29 insertions, 12 deletions
@@ -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* |