summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-06 21:15:34 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-06 21:15:34 -0700
commite1e8eedfd994463db4a3db048117c4bcd9aaf416 (patch)
tree838621b66f0cc70240bacee753f931b7f594724b
parent4ab49152980d3b9626d294af7d8ee9c296c09943 (diff)
downloadtxr-e1e8eedfd994463db4a3db048117c4bcd9aaf416.tar.gz
txr-e1e8eedfd994463db4a3db048117c4bcd9aaf416.tar.bz2
txr-e1e8eedfd994463db4a3db048117c4bcd9aaf416.zip
Handle sequence structs in length.
* lib.c (length): In COBJ case, handle structures which have a car slot.
-rw-r--r--lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 29d11ef9..89782b25 100644
--- a/lib.c
+++ b/lib.c
@@ -8048,6 +8048,8 @@ val length(val seq)
case COBJ:
if (seq->co.cls == hash_s)
return hash_count(seq);
+ if (structp(seq) && maybe_slot(seq, car_s))
+ return length_list(nullify(seq));
/* fallthrough */
default:
type_mismatch(lit("length: ~s is not a sequence"), seq, nao);