summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-11 22:52:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-11 22:52:31 -0700
commita540359de7335436fe431e46ae18a9823c01155a (patch)
tree7ca9068c22a6ca11135a4c98c6bff84ddcac3d2a /lib.c
parent082132f7d5d86068ab733f49fc4c43a9bd6157f1 (diff)
downloadtxr-a540359de7335436fe431e46ae18a9823c01155a.tar.gz
txr-a540359de7335436fe431e46ae18a9823c01155a.tar.bz2
txr-a540359de7335436fe431e46ae18a9823c01155a.zip
ffi: new carray-replace function.
Thanks to this (set [ca from..to] list) works. * ffi.c (carray_replace): New function. (ffi_init): Register carray-replace intrinsic. * ffi.h (carray_replace): Declared. * ffi.c (replace): Hook in carray_replace. * txr.1: Mention carray under replace, and document carray-replace.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 4c345615..43d429df 100644
--- a/lib.c
+++ b/lib.c
@@ -9263,6 +9263,10 @@ val replace(val seq, val items, val from, val to)
return replace_str(seq, items, from, to);
case VEC:
return replace_vec(seq, items, from, to);
+ case COBJ:
+ if (seq->co.cls == carray_s)
+ return carray_replace(seq, items, from, to);
+ /* fallthrough */
default:
type_mismatch(lit("replace: ~s is not a sequence"), seq, nao);
}