diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-06-05 20:18:58 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-06-05 20:18:58 -0700 |
commit | eb2d229637284ac6b8822357ce59c007742c825c (patch) | |
tree | f98faa041513dacb9cbec438a86a686486c086fc /lib.h | |
parent | f64eaa8c6839247c4e3023d244fdc328fd455e8d (diff) | |
download | txr-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.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |