Maged Zamzam wrote: > Dear all, > I have a Struct Journal in the CP code and I want to take each item in > the Journal to be displayed in Java explicitly without having to parse. > Is there a way to take the list of all Journals and convert into args?? On the Java side, a struct is represented as a CompoundTerm object (like any compound term). That means the arguments are identified only by their positions, and you can access them with the arg() method. To get the mapping of names to positions, you could make an rpc() and call current_struct(journal, _). This will return a compound term with the struct field names in the corresponding positions, which you can the use for printing. The equivalent in ECLiPSe: :- local struct(journal(title,year,publisher)). ?- current_struct(journal,X). X = journal(title, year, publisher) Yes (0.00s cpu) -- JoachimReceived on Sun Apr 11 2010 - 04:53:15 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST