4 ms·
> No standardized strings > ISO "strings" are just atoms or lists of single-character atoms (or lists of integer character codes) [...]. Code written with stri
by tannhaeuser 9mo ago
> No standardized strings
> ISO "strings" are just atoms or lists of single-character atoms (or lists of integer character codes) [...]. Code written with strings in SWI-Prolog will not work in [other] Prolog.
That's because SWI isn't following ISO (and even moving away from ISO in other places eg. [1]).
ISO Prolog strings are lists of character codes period. It's just that there are convenient string manipulation-like predicates operating on atom names such as sub_atom, atom_concat, atom_length, etc ([2]). You'd use atom_codes to converse between atoms/strings or use appropriate list predicates.
[1]: https://www.reddit.com/r/prolog/comments/1089peh/can_someone_please_explain_why_this_fails/ https://www.reddit.com/r/prolog/comments/1089peh/can_someone...
[2]: https://quantumprolog.sgml.net/docs/libreference.html#string-and-atom-predicates https://quantumprolog.sgml.net/docs/libreference.html#string...
- YeGoblynQueenne 9mo agoThat's where ISO clashes with the de-facto standard of its most popular implementation, that is also the best maintained. Too bad for ISO. ... we've disagreed about this before though :)