From bf2fbbc765012a3eafa8ef235ab568bde942fdd8 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 23 Feb 2022 07:35:36 -0800 Subject: New list-builder method: oust. * autoload.c (build_set_entries): Add oust symbol. * stdlib/build.tl (list-builder postinit): Call the self argument self instead of bc, for consistency with other methods. (list-builder oust): New method. (list-builder-flets): Add local function oust. * tests/012/seq.tl: New tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated. --- stdlib/build.tl | 15 +++++++++++---- stdlib/doc-syms.tl | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'stdlib') diff --git a/stdlib/build.tl b/stdlib/build.tl index 3837f43f..e5cba268 100644 --- a/stdlib/build.tl +++ b/stdlib/build.tl @@ -28,9 +28,16 @@ (defstruct list-builder () head tail - (:postinit (bc) - (set bc.head (cons nil bc.head) - bc.tail bc.head)) + (:postinit (self) + (set self.head (cons nil self.head) + self.tail self.head)) + + (:method oust (self . lists) + (if lists + (let ((nl [apply append lists])) + (set self.tail (usr:rplacd self.head nl))) + (set self.tail (usr:rplacd self.head nil))) + self) (:method add (self . items) (let ((st self.tail)) @@ -112,7 +119,7 @@ (defun sys:list-builder-flets (lb-form) (nconc - (collect-each ((op '(add add* pend pend* ncon ncon*))) + (collect-each ((op '(add add* pend pend* ncon ncon* oust))) ^(,op (. args) (qref ,lb-form (,op . args)) nil)) diff --git a/stdlib/doc-syms.tl b/stdlib/doc-syms.tl index 7a9348ee..95092836 100644 --- a/stdlib/doc-syms.tl +++ b/stdlib/doc-syms.tl @@ -1391,6 +1391,7 @@ ("orec" "N-0003ED2C") ("orf" "N-01E7D2AD") ("ors" "N-02D33A3D") + ("oust" "N-0126D3FF") ("output" "N-0159EBE7") ("package-alist" "N-017F684C") ("package-fallback-list" "N-027A535C") -- cgit v1.2.3