add atom_to_term/3.
This commit is contained in:
parent
b0ea945ebc
commit
8ec6791183
@ -10550,6 +10550,13 @@ Convert the number @var{Number} to the string of character codes
|
||||
Convert the atom @var{Number} to the difference list of character codes
|
||||
@var{Result-Result0}.
|
||||
|
||||
@item atom_to_term(+@var{Atom}, -@var{Term}, -@var{Bindings})
|
||||
@findex atom_to_term/3
|
||||
@syindex atom_to_term/3
|
||||
@cnindex atom_to_term/3
|
||||
Use @var{Atom} as input to @code{read_term/2} using the option @code{variable_names} and return the read term in @var{Term} and the variable bindings in @var{Bindings}. @var{Bindings} is a list of @code{Name = Var} couples, thus providing access to the actual variable names. See also @code{read_term/2}. If Atom has no valid syntax, a syntax_error exception is raised.
|
||||
|
||||
|
||||
@item read_from_chars(+@var{Chars}, -@var{Term})
|
||||
@findex read_from_chars/2
|
||||
@syindex read_from_chars/2
|
||||
|
@ -538,6 +538,13 @@ sub_atom(At, Bef, Size, After, SubAt) :-
|
||||
'$subtract_lists_of_variables'([V1|VL1],[V2|VL2],[V2|VL]) :-
|
||||
'$subtract_lists_of_variables'([V1|VL1],VL2,VL).
|
||||
|
||||
atom_to_term(Atom, Term, Bindings) :-
|
||||
atom_codes(Atom, Chars),
|
||||
charsio:open_mem_read_stream(Chars, Stream),
|
||||
read_term(Stream, T, [variable_names(Bindings)]),
|
||||
close(Stream),
|
||||
T = Term.
|
||||
|
||||
simple(V) :- var(V), !.
|
||||
simple(A) :- atom(A), !.
|
||||
simple(N) :- number(N).
|
||||
|
Reference in New Issue
Block a user