4 ms·
These use cases become especially interesting now with several recent Prolog systems such as Scryer, Tau, Trealla and ichiban/prolog: All these systems set the
by triska 4y ago
These use cases become especially interesting now with several recent Prolog systems such as Scryer, Tau, Trealla and ichiban/prolog: All these systems set the Prolog flag double_quotes to chars already by default, and this means that we can write lists of characters especially conveniently as double-quoted strings in programs in queries!
For example, the list of characters [a,b,c] can be conveniently written as "abc" in all these systems, and of course also if we manually set the flag to chars in any conforming Prolog system. Scryer and Trealla combine this default for the flag with an extremely efficient internal representation of strings, using packed UTF-8 encoding internally, so that also very large amounts of text can be efficiently and conveniently processed with DCGs. In Trealla Prolog, using phrase_from_file/2 even transparently maps the file contents to memory with the system call mmap(2) for extreme performance.