5.2 Recursion
Functions may be recursive, that is, they may call themselves, either directly or indirectly. Recursion is a powerful technique for many problems, and of course it’s essential for processing recursive data structures. In Section 4.4, we used recursion over a tree to implement a simple insertion sort. In this section, we’ll use it again for processing HTML documents.
The example program below uses a non-standard package,
golang.org/x/net/html, which provides an HTML parser.
The golang.org/x/... repositories hold packages designed
and maintained by the Go team for applications such as networking,
internationalized text processing, mobile platforms, image manipulation,
cryptography, and developer tools.
These packages are ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access