?CharList)Similar to atom_chars/2,
but converts between a number and its representation as a list of characters
(atoms of length 1).
- If CharList is a
proper list, i.e., not unbound or a partial list,
CharList is parsed according to the Prolog syntax for numbers
and the resulting number is unified with Number. A
exception is raised if CharList is instantiated to a ground,
proper list but does not represent a valid Prolog number.
- Otherwise, if Number is indeed a number, Number
is serialized and the result is unified with CharList.
Following the ISO standard, the Prolog syntax for number allows for
leading white space (including newlines) and does not allow for
trailing white space.118ISO
also allows for Prolog comments in leading white space. We--and most
other implementations--believe this is incorrect. We also believe it
would have been better not to allow for white space, or to allow for
both leading and trailing white space.
Prolog syntax-based conversion can also be achieved using format/3