summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-04 06:16:32 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-04 06:16:32 -0700
commit755f99d4f397cc2357468e3c2dc19d3ea451dedb (patch)
tree02358f6b761edff37462d732a97bea7033195842 /lib.c
parent20758a37854c852c5a6574ced48bb0aca9417132 (diff)
downloadtxr-755f99d4f397cc2357468e3c2dc19d3ea451dedb.tar.gz
txr-755f99d4f397cc2357468e3c2dc19d3ea451dedb.tar.bz2
txr-755f99d4f397cc2357468e3c2dc19d3ea451dedb.zip
length and empty functions support ranges.
* lib.c (length, empty): Handle RNG in switch. * txr.1: Documented.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 062f35c6..8676f9e2 100644
--- a/lib.c
+++ b/lib.c
@@ -8150,6 +8150,8 @@ val length(val seq)
return length_str(seq);
case VEC:
return length_vec(seq);
+ case RNG:
+ return minus(to(seq), from(seq));
case COBJ:
if (seq->co.cls == hash_s)
return hash_count(seq);
@@ -8176,6 +8178,8 @@ val empty(val seq)
return length_str_le(seq, zero);
case VEC:
return eq(length_vec(seq), zero);
+ case RNG:
+ return eql(from(seq), to(seq));
case COBJ:
if (seq->co.cls == hash_s)
return eq(hash_count(seq), zero);