1:- module(tidylog, [ codes_term/2 2 , variable_name/2 3 ]). 4 5:- use_module(library(tidylog/dcg)). 6 7 8% avoid "Undefined procedure" errors 9attr_unify_hook(_,_).
16codes_term(Codes, Term) :- 17 nonvar(Codes), 18 !, 19 once(phrase(read_prolog(Term),Codes)). 20codes_term(Codes,Term) :- 21 once(phrase(write_prolog(Term),Codes)).
30variable_name(Var,Name) :-
31 must_be(var, Var),
32 once( get_attr(Var, tidylog, name(Name))
33 ; throw("Variable not created by tidylog")
34 )