> <\body> Besides pattern matching on trees, provides the routine for pattern matching along paths. Given a tree, this mechanism typically allows the user to select all subtrees which are reached following a path which meets specific criteria. For instance, one might to select the second child of the last child or all square roots inside numerators of fractions. The syntax of the selection patterns is also used for high level tree accessors. <\explain> )> <|explain> Select all subtrees inside a hybrid tree according to a specific path . Patterns are lists of atomic patterns of one of the following forms: <\explain> , , , ... <|explain> Given an integer , select the -th child of the input tree. For instance, returns . <\explain> , <|explain> Select first or last child of the input tree. <\explain> )> <|explain> Select all children in a specified range. <\explain> <|explain> Select all compound subtrees with the specified . Example: <\session|scheme|default> <\unfolded-io|Scheme] > (select '(document (strong "x") (math "a+b") (strong "y")) '(strong)) <|unfolded-io> ((strong "x") (strong "y")) <\explain> , , , ... <|explain> The pattern , where is a number, selects all descendants of the -th generation. Example: <\session|scheme|default> <\unfolded-io|Scheme] > (select '(foo (bar "x" "y") (slash (dot))) '(:%2)) <|unfolded-io> ("x" "y" (dot)) <\explain> <|explain> This pattern selects all descendants of the tree. For instance, selects all square roots inside numerators of fractions inside . <\explain> )> <|explain> This pattern matches the input tree if and only the input tree matches the specified according to . Example: <\session|scheme|default> <\unfolded-io|Scheme] > (select '(foo "x" (bar)) '(:%1 (:match :string?))) <|unfolded-io> ("x") Example with creation of a custom predicate: <\session|scheme|default> <\unfolded-io|Scheme] > (select '(foo "x" (bar)) '(:* (:match :tree-atomic?))) <|unfolded-io> () <\input|Scheme] > \; List of useful predicates: \; <\explain> ... )> ... )> <|explain> These rules allow for the selection of all subtrees which satisfy one among or all patterns until . In the case when the input tree is active, the function supports some additional patterns which allow the user to navigate inside the tree. <\explain> <|explain> This pattern selects the parent of the input tree, if it exists. <\explain> <|explain> If the cursor is inside some child of the input tree, then this pattern will select this child. <\explain> <|explain> If the input tree is the -th child of its parent, then this pattern will select the >-th child. <\explain> <|explain> If the input tree is the -th child of its parent, then this pattern will select the >-th child. <\initial> <\collection>