I am using SICStus Prolog to write a Dali agent and I need to convert an atom to a term but I can't use atom_to_term
which is built in in SWI-Prolog
Asked
Active
Viewed 322 times
4

false
- 10,264
- 13
- 101
- 209

user3025515
- 67
- 4
1 Answers
4
Use library(codesio)
:
| ?- use_module(library(codesio)).
yes
?- set_prolog_flag(double_quotes,codes).
true.
| ?- read_from_codes("a(X,Y).",T).
T = a(_A,_B) ? yes
| ?- read_term_from_codes("a(X,Y).",T,[variable_names(VN_list)]).
T = a(_A,_B),
VN_list = ['X'=_A,'Y'=_B] ?
In addition to that, you need atom_codes/2
which is ISO.
For more complex operations, you can open a stream with open_codes_stream/2
. Which needs to be closed with close/1
.

false
- 10,264
- 13
- 101
- 209
-
can you please take a look at what I'm trying to do and help achieve it as explained in the edited question? – user3025515 Nov 23 '13 at 21:28
-
@user3025515: Write a new question for this. You asked a different question. I will revert what you added, after you added the question. – false Nov 23 '13 at 21:44