summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-07-22 20:41:54 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-07-22 20:41:54 -0700
commitd6760da67732419d8043d1fdc43e8081f96ef1f1 (patch)
tree021b792bbba89c65d5fbfeaa9132f6325988d11b /txr.1
parent0dd87c5b673f94f06263ace234e689e953bf3393 (diff)
downloadtxr-d6760da67732419d8043d1fdc43e8081f96ef1f1.tar.gz
txr-d6760da67732419d8043d1fdc43e8081f96ef1f1.tar.bz2
txr-d6760da67732419d8043d1fdc43e8081f96ef1f1.zip
Adding nthcdr as accessor.
* eval.c (eval_init): Register nthcdr function. * lib.c (nthcdr): New function. * lib.h (nthcdr): Declared. * share/txr/stdlib/place.tl (nthcdr): New defplace. * txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.160
1 files changed, 60 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index dc02fd99..7afaa51a 100644
--- a/txr.1
+++ b/txr.1
@@ -14191,6 +14191,66 @@ then
.code nil
is returned.
+.coNP Accessor @ nthcdr
+.synb
+.mets (nthcdr < index << list )
+.mets (set (nthcdr < index << list ) << new-value )
+.syne
+.desc
+The
+.code nthcdr
+function retrieves the n-th cons cell of a list, indexed from zero.
+The
+.meta index
+parameter must be a non-negative integer. If
+.meta index
+specifies a nonexistent cons beyond the end of the list,
+then
+.code nthcdr
+yields nil.
+The following equivalences hold:
+
+.cblk
+ (nthcdr 0 list) <--> list
+ (nthcdr 1 list) <--> (cdr list)
+ (nthcdr 2 list) <--> (cddr list)
+.cble
+
+An
+.code nthcdr
+place designates the storage location which holds the n-th cell,
+as indicated by the value of
+.metn index .
+Indices beyond the last cell of
+.meta list
+do not designate a valid place.
+If
+.meta list
+is itself a place, then the zeroth index is permitted and the
+resulting place denotes
+.metn list .
+Storing a value to
+.cblk
+.meti (nthcdr < 0 << list)
+.cble
+overwrites
+.metn list .
+Otherwise if
+.meta list
+isn't a syntactic place, then the zeroth index does not designate a valid
+place;
+.meta index
+must have a positive value. A
+.code nthcdr
+place does not support deletion.
+
+.TP* "Dialect Note:"
+In Common Lisp,
+.code nthcdr
+is only a function, not an accessor;
+.code nthcdr
+forms do not denote places.
+
.coNP Accessors @, caar @, cadr @, cdar @, cddr ... @ cdddddr
.synb
.mets (caar << object )