diff options
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)))) |