term_string/2 is (de)serialization of a Prolog term to/from text (a
string). That means the text must have valid Prolog syntax. If you
want an atom, use atom_string/2. If you want an atom as fallback,
use catch/3 around term_string, as in:
catch(term_string(Term, String),
error(syntax_error(_),_),
atom_string(Term, String)).
I can't see many cases where this is a smart idea ...
Cheers --- Jan
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
swi-prolog+...@googlegroups.com
> <mailto:
swi-prolog+...@googlegroups.com>.
> Visit this group at
https://groups.google.com/group/swi-prolog.
> For more options, visit
https://groups.google.com/d/optout.