summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-11 11:06:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-11 11:06:38 -0700
commit9fca64292256f980e8cb15cea8c3e6cc7fd76374 (patch)
tree0bf7936c668cd69ce87b6b2735427b817e14bb7a /lib.c
parent0687743dcfad79dba202b4411a5b51f6954cf3b2 (diff)
downloadtxr-9fca64292256f980e8cb15cea8c3e6cc7fd76374.tar.gz
txr-9fca64292256f980e8cb15cea8c3e6cc7fd76374.tar.bz2
txr-9fca64292256f980e8cb15cea8c3e6cc7fd76374.zip
ffi: handle sub operation in carray.
Thus, [ca 3..5] syntax works for slice extraction. However, this works referentially, not by making a copy. The extracted subarray points to the original memory, until carray-dup is invoked on it. * ffi.c (carray_sub): New function. (ffi_init): carray-sub intrinsic registered. * ffi.h (carray_sub): Declared. * lib.c (sub): Handle carray via carray_sub. * txr.1: Documented changes in sub.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 6e14e618..4c345615 100644
--- a/lib.c
+++ b/lib.c
@@ -9179,6 +9179,8 @@ val sub(val seq, val from, val to)
case NIL:
return nil;
case COBJ:
+ if (seq->co.cls == carray_s)
+ return carray_sub(seq, from, to);
seq = nullify(seq);
/* fallthrough */
case CONS: