Selectors

A selector is a Prolog term denoting a (path to a) subterm of a given term T. Let subterm(T,S) denote the subterm of T wrt. a selector S, and let N denote an integer. A selector then takes one of the following forms:

S subterm(T,S)
[] T
[...,N] Nth argument of the compound term subterm(T,[...])
[...,#N] Nth element of the list subterm(T,[...])