I was browsing the IO manual pages in swi-prolog and couldn’t find a predicate to read integers (or numbers) from a file/stream. Didn’t find anything on google either 😐
I know how to write one, just wondering if there is something built-in since I guess that it would be faster.
In SWI-Prolog, there is library(dcg_basics) in the “http” package. It has a DCG non-terminal number//1, and you can use it with library(pio), i.e., phrase_from_file/2, to read directly from a file (without having to read the whole file at once). There was some discussion on the mailing list to include library(dcg_basics) in the core libraries, if you are interested check the archives and send a mail to the list. I think it would be a very useful addition to the libraries.