summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-06-05 20:18:58 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-06-05 20:18:58 -0700
commiteb2d229637284ac6b8822357ce59c007742c825c (patch)
treef98faa041513dacb9cbec438a86a686486c086fc /lib.h
parentf64eaa8c6839247c4e3023d244fdc328fd455e8d (diff)
downloadtxr-eb2d229637284ac6b8822357ce59c007742c825c.tar.gz
txr-eb2d229637284ac6b8822357ce59c007742c825c.tar.bz2
txr-eb2d229637284ac6b8822357ce59c007742c825c.zip
nullify and empty: convert to seq_info.
Issues: (nullify 1..1) doesn't return nil as it should, and (empty 1) fails. * lib.c (seq_info): Since we would like nullify to use seq_info, seq_info cannot call nullify. Transplant the probing of the nullify method out of nullify and into here. (nullify): Obtain a seq_info_t on the object. If it's not a sequence and is not range, then just return the object. Otherwise obtain a seq_iter_t sequence and peek whether it has a next item. (empty): Similarly, obtain an iterator and peek. Definition of empty is relocated to be next to nullify. * lib.h: Relocate declaration of empty, also.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib.h b/lib.h
index 770fefc7..dff5f178 100644
--- a/lib.h
+++ b/lib.h
@@ -617,7 +617,8 @@ val push(val v, val *plist);
val copy_list(val list);
val make_like(val list, val thatobj);
val tolist(val seq);
-val nullify(val seq);
+val nullify(val obj);
+val empty(val seq);
val seqp(val obj);
val nreverse(val in);
val reverse(val in);
@@ -1166,7 +1167,6 @@ val isec(val list1, val list2, val testfun, val keyfun);
val uni(val list1, val list2, val testfun, val keyfun);
val copy(val seq);
val length(val seq);
-val empty(val seq);
val sub(val seq, val from, val to);
val ref(val seq, val ind);
val refset(val seq, val ind, val newval);