diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-06-01 20:35:54 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-06-01 20:35:54 -0700 |
commit | 51b5284d6a252402abd054175f5fde11e88c2b54 (patch) | |
tree | a1f7bd79d3dba7b5e87d1fbb1e107136ec2a77e3 | |
parent | cd8cf4f8fd827e428c53f2e6d7fcce5cd9727e7f (diff) | |
download | txr-51b5284d6a252402abd054175f5fde11e88c2b54.tar.gz txr-51b5284d6a252402abd054175f5fde11e88c2b54.tar.bz2 txr-51b5284d6a252402abd054175f5fde11e88c2b54.zip |
ldiff uses equal for all non-list arguments.
* lib.c (ldiff): Rather than checking specifically for
strings and vectors to apply the special case behavior
(comparison using equal), test specifically for lists and
apply the traditional behavior. Every other object,
not just strings and vectors, gets the altered behavior.
* txr.1: Changed text in TXR Lisp introduction which touches
on ldiff, and wording fix under ldiff.
-rw-r--r-- | lib.c | 11 | ||||
-rw-r--r-- | txr.1 | 6 |
2 files changed, 8 insertions, 9 deletions
@@ -1298,17 +1298,16 @@ val ldiff(val list1, val list2) list2 = nullify(list2); switch (type(list2)) { - case STR: - case LIT: - case LSTR: - case VEC: - while (list1 && !equal(list1, list2)) { + case NIL: + case CONS: + case LCONS: + while (list1 && list1 != list2) { ptail = list_collect(ptail, car(list1)); list1 = cdr(list1); } break; default: - while (list1 && list1 != list2) { + while (list1 && !equal(list1, list2)) { ptail = list_collect(ptail, car(list1)); list1 = cdr(list1); } @@ -10310,8 +10310,8 @@ can also be treated in the same way. The .code ldiff function is also extended in a special way. When the right parameter -is a string or vector, then it uses the equal equality test rather than eq -for detecting the tail of the list. +a non-list sequence, then it uses the equal equality test rather than eq for +detecting the tail of the list. .cblk (ldiff "abcd" "cd") -> (#\ea #\eb) @@ -15710,7 +15710,7 @@ then a copy of .meta list is returned. -These functions also work more generally on sequences. +This function also works more generally on sequences. The .meta list and |