diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-06-17 23:16:22 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-06-17 23:16:22 -0700 |
commit | e545f014c3e3336c929e0981948cc8f62423be7e (patch) | |
tree | 2a36f8452dd2ab3228d0c27121fee914fed0f0b1 /share | |
parent | 60d79d3d94445b9b27c1b394499995847e889d64 (diff) | |
download | txr-e545f014c3e3336c929e0981948cc8f62423be7e.tar.gz txr-e545f014c3e3336c929e0981948cc8f62423be7e.tar.bz2 txr-e545f014c3e3336c929e0981948cc8f62423be7e.zip |
sub-list, sub-vec, sub-str: becoming accessors.
* lisplib.c (defset_instantiate): Add sub-list, sub-vec and
sub-str symbols as autoload triggers for defset.tl.
* share/txr/stdlib/defset.tl (sub-list, sub-vec, sub-str): New
syntactic places defined with defset.
* txr.1: sub-list, sub-vec and sub-str documented as
accessors.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/defset.tl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/share/txr/stdlib/defset.tl b/share/txr/stdlib/defset.tl index 7a2dd6fd..d666f199 100644 --- a/share/txr/stdlib/defset.tl +++ b/share/txr/stdlib/defset.tl @@ -105,3 +105,18 @@ ((get-fun set-fun) (defset-expander-simple mf get-fun set-fun)) (x (compile-error mf "invalid syntax")))) + +(defset sub-list (list : (from 0) (to t)) items + (let ((it (gensym))) + ^(alet ((,it ,items)) + (progn (set ,list (replace-list ,list ,it ,from ,to)) ,it)))) + +(defset sub-vec (vec : (from 0) (to t)) items + (let ((it (gensym))) + ^(alet ((,it ,items)) + (progn (replace-vec ,vec ,it ,from ,to) ,it)))) + +(defset sub-str (str : (from 0) (to t)) items + (let ((it (gensym))) + ^(alet ((,it ,items)) + (progn (replace-str ,str ,it ,from ,to) ,it)))) |