diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-02-13 06:54:42 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-02-13 06:54:42 -0800 |
commit | 014c61e860fce07cceee60efecd949a17e53f2ae (patch) | |
tree | 5a3ffb653eb25298582cbb458e53d804197076ff /txr.1 | |
parent | bb5d5d3efed8491ce2159abdf3da2114db91e5eb (diff) | |
download | txr-014c61e860fce07cceee60efecd949a17e53f2ae.tar.gz txr-014c61e860fce07cceee60efecd949a17e53f2ae.tar.bz2 txr-014c61e860fce07cceee60efecd949a17e53f2ae.zip |
optimizing diff, isec and uni for non-lists.
Also, these functions now support hashes.
* eval.c (eval_init): Register only the deprecated set-diff to
the set_diff function. The diff intrinsic is now going to the
new function named diff.
* lib.c (diff): New function.
(isec, uni): Rewritten to use seq_iter_t.
* lib.h (diff): Declared.
* txr.1: Documentation updated.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 39 |
1 files changed, 36 insertions, 3 deletions
@@ -28728,13 +28728,27 @@ and returning a new sequence: the union sequence, intersection sequence and difference sequence. -The sequences +The arguments .meta seq1 and .meta seq2 -need not be of the same kind. +need not be of the same kind. They may be hash tables. + The returned sequence is of the same kind as .metn seq1 . +If +.meta seq1 +is a hash table, the returned sequence is a list. + +For the purposes of these functions, an input which is a hash table +is considered as if it were a sequence of hash key and hash +value pairs represented as cons cells, the +.code car +slots of which are the hash keys, and the +.code cdr +of which are the hash values. This means that if no +.meta keyfun +is specified, these pairs are taken as keys. Since the input sequences are defined as representing sets, they are assumed not to contain duplicate elements. These functions are not required, but may, @@ -28812,7 +28826,7 @@ then the .code equal function is used. -Note: a function identical to +Note: a function similar to .code diff named .code set-diff @@ -28830,6 +28844,25 @@ function, but is honored by the implementation for at as long as the .code set-diff synonym continues to be available. +The +.code set-diff +function doesn't support hash tables and is inefficient for vectors and +strings. + +Note: these functions are not efficient for the processing of hash tables, +even when both inputs are hashes, the +.meta keyfun +argument is +.codn car , +and +.meta testfun +matches the equality used by both hash table inputs. +If applicable, the operations +.codn hash-uni , +.code hash-isec +and +.code hash-diff +should be used instead. .coNP Functions @, mapcar @, mappend @ mapcar* and @ mappend* .synb |