chickadee » sxpath » take-after

take-until pred?procedure
take-after pred?procedure

Returns a procedure that accepts a node or a nodelist.

The take-until variant returns everything before the first node for which the predicate pred? returns anything but #f or '(). In other words, it returns the longest prefix for which the predicate returns #f or '().

The take-after variant returns everything after the first node for which the predicate pred? returns anything besides #f or '().

((take-until (ntype?? 'span)) '((div "hi") (span "hello") (span "there") (div "still here?")))
 => ((div "hi"))

((take-after (ntype?? 'span)) '((div "hi") (span "hello") (span "there") (div "still here?")))
 => ((span "there") (div "still here?"))