chickadee » i3 » filter-containers

filter-containers predicate treeprocedure

Returns a list containing all containers for which the given predicate returns #t.

Predicate which is evaluated for each i3 container. Only containers for which the predicate returns #t are included in the return list
(Part of) a list of containers as returned by (tree).
(define (filter-containers predicate tree)
  (if (null? tree)
      (if (predicate tree) (list tree) (list))
      (apply append
               (lambda (node) (filter-containers predicate node))
               (cdr (assoc 'nodes tree)))))))