summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-12-16 06:14:10 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-12-16 06:14:10 -0800
commit9bd8fabc9f45dbdb7c66c44f255904ab62df4ee3 (patch)
tree94294509dda1092ab631c9453d03817e3e7dab09 /lib.c
parent2bc41c8920513856daa73018e6b9f9c54f456fe2 (diff)
downloadtxr-9bd8fabc9f45dbdb7c66c44f255904ab62df4ee3.tar.gz
txr-9bd8fabc9f45dbdb7c66c44f255904ab62df4ee3.tar.bz2
txr-9bd8fabc9f45dbdb7c66c44f255904ab62df4ee3.zip
bugfix: dwim_set not handling hash correctly.
* lib.c (dwim_set): When the range argument is a vector or list, it is wrongly hangled through replace, even if seq is a hash. replace throws since it doesn't handle hashes. We must treat the vector or list as a hash key and handle through sethash.
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 14a2b65a..6041a11e 100644
--- a/lib.c
+++ b/lib.c
@@ -7625,6 +7625,10 @@ val dwim_set(val seq, val ind_range, val newval)
case CONS:
case LCONS:
case VEC:
+ if (hashp(seq)) {
+ (void) sethash(seq, ind_range, newval);
+ return seq;
+ }
return replace(seq, newval, ind_range, colon_k);
case RNG:
if (!hashp(seq))