One of the hardest things is finding stuff. I have myself many times failed to find things that were right in front of my face (asking if keysort/2
is stable stands out in my memory as one of the more embarrassing examples) . At some point I even suspected that Jan reads my questions, then re-writes the documentation and the git history, then tells me “it is right there in the documentation”, as a practical joke.
Here are a few tricks (my kids call them “lifehacks”, which seems to be an example of the euphemism treadmill):
Reading the source
This is useful and sometimes necessary. It is difficult and time consuming, but educational. It doesn’t directly solve the problem, but you can search the code using full text search, for example, inside the swipl-devel root directory:
$ grep -r '\<flush\>' | less
man/builtin.doc: \termitem{flush}{}
library/tty.pl: format(' Your choice? ~T', [clear_display, flush]),
library/tty.pl:tty_action(flush) :-
library/win_menu.pl: [ 'Opening ~w ... '-[Url], flush ].
library/backcomp.pl: flush/0,
library/backcomp.pl:%! flush is det.
library/backcomp.pl:flush :-
and so on. By a stroke of pure luck, the first few lines already suggest there is indeed something called “flush”. It would require additional investigation, but at least we have a lead.
Of course, this is an overkill and last resort (which is why I mentioned it first).
Using the search function of the SWI-Prolog website
I realize this is a bit counter intuitive, but bear with me. Here is what happens if I open the home page and start typing “flush” in the search bar:
I got lucky again: just blindly typing “flush” in the search bar I get few hits that make me hopeful that I am getting close to what I need.
Finding with the browser
This is a habit that was admittedly not easy to get into. If I feel like I should be close to what I am looking for, but can’t seem to find it, just hit Ctrl+F
on your keyboard and start typing. For example, when I was looking at keysort/2
, had I done that, I would have seen:
Similarly, if you go to the aptly named “Input and output” section of the manual, and try to find “flush”, you get immediately thrown to:
… and suddenly flushing the output is only a click away!
I am sure that there are many other tips and tricks people could provide on the topic of finding stuff. This is already turning into a blog post and this was definitely not my intent.