diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-06-25 06:51:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-06-25 06:51:17 -0700 |
commit | 848bd63a3051d06efc7c4efbaacbca7cfc768c06 (patch) | |
tree | 31b52c1dcad424be956262741acdef3304eb59eb | |
parent | b41ee52db4b65877208a9100e9f5eb7ecad97359 (diff) | |
download | txr-848bd63a3051d06efc7c4efbaacbca7cfc768c06.tar.gz txr-848bd63a3051d06efc7c4efbaacbca7cfc768c06.tar.bz2 txr-848bd63a3051d06efc7c4efbaacbca7cfc768c06.zip |
seqp: expand definition of sequences.
* lib.c (seqp): Use seq_info to classify the object
as a sequence.
* txr.1: Update description of seqp.
-rw-r--r-- | lib.c | 14 | ||||
-rw-r--r-- | txr.1 | 17 |
2 files changed, 18 insertions, 13 deletions
@@ -1021,18 +1021,8 @@ val nullify(val seq) val seqp(val obj) { - switch (type(obj)) { - case NIL: - case CONS: - case LCONS: - case VEC: - case STR: - case LSTR: - case LIT: - return t; - default: - return nil; - } + seq_info_t si = seq_info(obj); + return tnil(si.kind != SEQ_NOTSEQ); } loc list_collect(loc ptail, val obj) @@ -27715,11 +27715,26 @@ if is a sequence, otherwise .codn nil . -A sequence is defined as a list, vector or string. The object +Lists, vectors and strings are sequences. The object .code nil denotes the empty list and so is a sequence. +Objects of type +.code buf +and +.code carray +are sequences, as are hash tables. + +Structures which implement the +.code length +or +.code car +methods are considered sequences. + +No other objects are sequences. However, future revisions of +the language may specify additional objects that are sequences. + .coNP Functions @ length and @ len .synb .mets (length << object ) |