diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-12-12 06:35:12 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-12-12 06:35:12 -0800 |
commit | d05841efc07ad0300dbfe2d3f3d67131434a8e3c (patch) | |
tree | aa0df0614aacf4377ba25b1f3980e0a3f5b78c8b /txr.1 | |
parent | e48f1416f777022e215a5b79d86512d365cc550c (diff) | |
download | txr-d05841efc07ad0300dbfe2d3f3d67131434a8e3c.tar.gz txr-d05841efc07ad0300dbfe2d3f3d67131434a8e3c.tar.bz2 txr-d05841efc07ad0300dbfe2d3f3d67131434a8e3c.zip |
Adding mismatch function.
* eval.c (eval_init): Register mismatch intrinsic.
* lib.c (mismatch): New function.
* lib.c (mismatch): Declared.
* txr.1: Documented mismatch.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -24729,6 +24729,47 @@ from is passed through this one-argument function, and the resulting value is used in its place. +.coNP Function @ mismatch +.synb +.mets (mismatch < left-seq < right-seq >> [ testfun <> [ keyfun ]]) +.syne +.desc +The +.code mismatch +function compares corresponding elements from the sequences +.meta left-seq +and +.metn right-seq , +returning the position at which the first mismatch occurs. + +If the sequences are of the same length, and their corresponding +elements are the same, then +.code nil +is returned. + +If one sequence is shorter than the other, and matches a prefix +of the other, then the mismatching position returned is one position +after the last element of the shorter sequence, the same value +as its length. An empty sequence is a prefix of every sequence. + +The +.meta keyfun +argument defaults to the +.code identity +function. Each element +from +.meta sequence +is passed to +.meta keyfun +and the resulting value is used in its place. + +After being converted through +.metn keyfun , +items are then compared using +.metn testfun , +which must accept two arguments, and defaults to +.codn equal . + .coNP Function @ where .synb .mets (where < function << object ) |