If you replace the object with "term", then Prolog will do this naturally (in fact, there is no other way to build the object). Here is an example with binary trees:
% find a node in List with a nil left child and call its rightmost grandchild X member(node(nil,node(_,X)), List).
Lisp, and the circuit also has some interesting features in this area, in particular, quoting and half quoting:
Almost all functional programming languages ​​have copied this in some form.
source share