Common Lisp the Language, 2nd Edition This section presents a
number of complex transducers, including ones that support
conditional computation. choose bools &optional (items bools)
choose-if pred items Each of these functions takes in a series
of elements (items) and returns a series containing the same
elements in the same order, but with some elements removed.
choose removes itemsj if boolsj is nil or j is beyond the end of
bools. If items is omitted, choose returns the non-null elements
of bools. choose-if removes itemsj if (pred itemsj) is nil.
(choose #Z(t nil t nil) #Z(a b c d)) => #Z(a c) (collect-sum
(choose-if #'plusp #Z(-1 2 -3 4))) => 6 expand bools items
&optional (default nil) expand is a quasi-inverse of choose. The
output contains the elements of the input series items spread
out into the positions specified by the non-null elements in
bools-that is, itemsj is in the position occupied by the jth
non-null element in bools. The other positions in the output are
occupied by default. The output s