diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-02-26 19:59:52 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-02-26 19:59:52 -0800 |
commit | d55a709ba76b8696c9c05f63d1d0b40564e203c8 (patch) | |
tree | b3180ed4b315932de0fc85313231d5cd9b54a97d /share | |
parent | 3f0c43974617e91aa3b5ac80f5e3348c8812f293 (diff) | |
download | txr-d55a709ba76b8696c9c05f63d1d0b40564e203c8.tar.gz txr-d55a709ba76b8696c9c05f63d1d0b40564e203c8.tar.bz2 txr-d55a709ba76b8696c9c05f63d1d0b40564e203c8.zip |
list-builder: methods return object.
The list-builder methods, other than del, del* and get,
now return the object instead of nil.
* share/txr/stdlib/build.tl (list-builder (add, add*, pend,
pend*, ncon, ncon*): Return the object, self.
(list-builder-flets): Do not return the object out of the
local functions which invoke the above methods.
* txr.1: Documented.
Diffstat (limited to 'share')
-rw-r--r-- | share/txr/stdlib/build.tl | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/share/txr/stdlib/build.tl b/share/txr/stdlib/build.tl index 7f0d91c9..1b27d17b 100644 --- a/share/txr/stdlib/build.tl +++ b/share/txr/stdlib/build.tl @@ -37,12 +37,12 @@ (let ((tl (last st))) (usr:rplacd tl (append (cdr tl) items)) (set self.tail tl))) - nil) + self) (:method add* (self . items) (let ((h self.head)) (usr:rplacd h (append items (cdr h)))) - nil) + self) (:method pend (self . lists) (when lists @@ -53,14 +53,14 @@ (nl [apply append lists])) (usr:rplacd tl (append (cdr tl) (if cp (copy-list nl) nl))) (set self.tail tl))) - nil)) + self)) (:method pend* (self . lists) (let* ((h self.head) (pf [apply append (append lists (list (cdr h)))])) (usr:rplacd h pf) (set self.tail h)) - nil) + self) (:method ncon (self . lists) (when lists @@ -68,7 +68,7 @@ (nl [apply nconc lists])) (usr:rplacd tl (nconc (cdr tl) nl)) (set self.tail tl)) - nil)) + self)) (:method ncon* (self . lists) (let* ((h self.head) @@ -76,7 +76,7 @@ (usr:rplacd h pf) (if (eq self.tail h) (set self.tail pf))) - nil) + self) (:method get (self) (cdr self.head)) @@ -113,7 +113,8 @@ (nconc (collect-each ((op '(add add* pend pend* ncon ncon*))) ^(,op (. args) - (qref ,lb-form (,op . args)))) + (qref ,lb-form (,op . args)) + nil)) ^((get () (qref ,lb-form (get))) (del* () |