eta.util.general.extract_category
- extract_category(lst, catfn, ignfn=None)[source]
Recurse through a (possibly nested) list and extract categories that satisfy a given function.
- Parameters:
lst (s-expr) –
catfn (function) – A function used to match categories to be extracted.
ignfn (function, optional) – If given, a function used to ignore matching subexpressions (i.e., avoid recursing within them).
- Returns:
lst_new (s-expr) – The input list with matching subexpressions removed.
categories (list[s-expr]) – A list of extracted matching subexpressions.