I'd like to be able to do something like this:
(search data
list?
(fn [x] (and (list? x) (= 4 (first x))))
(fn [x] (and (set? x) (contains x 3))))
And have it recursively search a nested data structure data
:
- first for the shallowest lists (might be in a set of sets, for example).
- then within those lists for the shallowest lists who's first element is
4
. - then in those lists for the shallowest sets that contain 3.
- finally returning a list of items found in step 3.
Before I reinvent the wheel, is there a standard way of doing this?