summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-10-31 06:49:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-10-31 06:49:22 -0700
commit4b4ef6dfcf12e1db846b26a3b812aa010360d62f (patch)
treea80e4d82757e2385fa731f4fc07beb362e41d7d9 /lib.h
parente7523b22158785bcd542f2abfe3a3e0d96b7b1ab (diff)
downloadtxr-4b4ef6dfcf12e1db846b26a3b812aa010360d62f.tar.gz
txr-4b4ef6dfcf12e1db846b26a3b812aa010360d62f.tar.bz2
txr-4b4ef6dfcf12e1db846b26a3b812aa010360d62f.zip
Relax restrictions on dwim places.
No longer require the leftmost expression in a dwim place to itself be a place, except when the expression evaluates to a list, and the list is subject to an element deletion or a range operation. * eval.c (eval_init): Register dwim-set and dwim-del with one additional argument that the C functions now take. * lib.c (dwim_set, dwim_del): Take a new place_p argument which informs these functions whether the object they are operating on came from a syntactic place. The forbidden situations are diagnosed based on this flag: modification of the subrange of a list, or deletion of a list ref. Some error messages reworded. * lib.h (dwim_set, dwim_del): Declarations updated. * share/txr/stdlib/place.tl (defplace dwim): Produce a different update, clobber and delete expansion when the obj-place form isn't a place. In the non-place case, do not assign the result of the sys:dwim-set or sys:dwim-del operation back obj-place. Furthermore, pass a Boolean flag to sys:dwim-set and sys:dwim-del indicating which situation is the case: did the object argument come from a place or non-place. * txr.1: Documentation updated.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib.h b/lib.h
index 8bc72fd4..50ee8640 100644
--- a/lib.h
+++ b/lib.h
@@ -962,8 +962,8 @@ val empty(val seq);
val sub(val seq, val from, val to);
val ref(val seq, val ind);
val refset(val seq, val ind, val newval);
-val dwim_set(val seq, varg);
-val dwim_del(val seq, val ind_range);
+val dwim_set(val place_p, val seq, varg);
+val dwim_del(val place_p, val seq, val ind_range);
val butlast(val seq, val idx);
val replace(val seq, val items, val from, val to);
val update(val seq, val fun);