At this point I will stop looking but just because I did not find it does not mean it does not already exist. I typically search the built-in predicates, libraries, packages, packs, SWI-Prolog source code and read the books. Sometimes I also ask.
Searching the source code is hardest because sometimes there are data structures hidden in the code that are not exposed. If you know Object Oriented code think of it like an inner class. You also have to search all of the repositories.