summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-03-09 07:07:59 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-03-09 07:07:59 -0800
commit7450285654ee48e010199f2e615a3451e09872f4 (patch)
treec97f186f1e334b67bd1a0385c30d73b943f04b12 /lib.h
parentf33ace67e4e0760a423b460bb76ad2b99f49b2cd (diff)
downloadtxr-7450285654ee48e010199f2e615a3451e09872f4.tar.gz
txr-7450285654ee48e010199f2e615a3451e09872f4.tar.bz2
txr-7450285654ee48e010199f2e615a3451e09872f4.zip
lib: new functions join, join-with.
That old cat-str function is often a pain, requiring the pieces as a list. We have a sys:fmt-join that is undocumented. That functions is now exposed as usr:join, and documented. Also introducing join-with that takes a separator as the leftmost argument. Thus (op join-with "::") gives us a function that joins pieces with :: in between. * eval.c (eval_init): Regiser fmt_join function under join symbol also. Register join-with. * lib.c (join_with): New function. (fmt_join): Now a wrapper for join_with that passes a nil separator. * lib.h (join_with): Declared. * share/txr/stdlib/optimize.tl (basic-blocks join-blocks): Rename the local function join, which now triggers a warning about a standard function being redefined. * txr.1: Redocumented cat-str, and documented join-with and join.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index 3a519905..cd357004 100644
--- a/lib.h
+++ b/lib.h
@@ -873,6 +873,7 @@ val cat_str(val list, val sep);
val scat(val sep, ...);
val scat2(val s1, val s2);
val scat3(val s1, val sep, val s2);
+val join_with(val sep, struct args *args);
val fmt_join(struct args *args);
val split_str(val str, val sep);
val split_str_keep(val str, val sep, val keep_sep);