diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-03-12 20:40:03 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-03-12 20:40:03 -0700 |
commit | e39f3fcc0520ce0d93082a8b8e87187eb38efd48 (patch) | |
tree | 35c82a812f230e08405eb365a7fec4badc42af3f /txr.1 | |
parent | df45e73d23d6871ce0ca415e009bf1bd2a520804 (diff) | |
download | txr-e39f3fcc0520ce0d93082a8b8e87187eb38efd48.tar.gz txr-e39f3fcc0520ce0d93082a8b8e87187eb38efd48.tar.bz2 txr-e39f3fcc0520ce0d93082a8b8e87187eb38efd48.zip |
New functions starts-with and ends-with.
* eval.c (eval_init): Register starts-with and ends-with
intrinsics.
* lib.c (starts_with, ends_with): New functions.
* lib.c (starts_with, ends_with): Declared.
* txr.1: Documented.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 47 |
1 files changed, 47 insertions, 0 deletions
@@ -25678,6 +25678,53 @@ mismatching position, regarded from the end. If the sequences match only in the rightmost element, then -1 is returned. If they match in two elements then -2 and so forth. +.coNP Functions @ starts-with and @ ends-with +.synb +.mets (starts-with < short-seq < long-seq >> [ testfun <> [ keyfun ]]) +.mets (ends-with < short-seq < long-seq >> [ testfun <> [ keyfun ]]) +.syne +.desc +The +.code starts-with +and +.code ends-with +functions compare corresponding elements from sequences +.meta short-seq +and +.metn long-seq . + +The +.code starts-with +function returns +.code t +if +.meta short-seq +is prefix of +.metn long-seq ; +otherwise, it returns +.codn nil . + +The +.code ends-with +function returns +.code t +if +.meta short-seq +is suffix of +.metn long-seq ; +otherwise, it returns +.codn nil . + +Element from both sequences are mapped to comparison keys using +.metn keyfun , +which defaults to +.codn identity . + +Comparison keys are compared using +.meta testfun +which defaults to +.codn equal . + .coNP Function @ select .synb .mets (select < object >> { index-list <> | function }) |