regarding findall, you should look into aggregate functions like bag{...} and set{...}.
regarding the forall(....) statement, yes it translates into expressions that involves \naf, which is using a tabled predicate. Instead, I'd use
an approach similar to Prolog's - a fail loop:
office[contains->{desk,computer}].
%write_all_contents(?container) :-
write('Contents: ')@\io,
%write_data(?container).
%write_all_contents(?) :- nl@\io.
%write_data(?container) :-
?container[contains->?c],
fmt_write(' %s', arg(?c))@\io,
\false.
%write_data(?) :- \true.
?- %write_all_contents(office).
Another approach is to use abolish_all_tables in your version. This is more declarative, but uses a somewhat tricky op:
%write_all_contents2(?container) :-
write('Contents2: ')@\io,
forall(?c)^(?container[contains->?c]~~>fmt_write('
%s', arg(?c))@\io),
nl@\io,
abolish_all_tables@\plg.
?- %write_all_contents2(office).
In that case, make sure that no tabled pred/method depends on %write_all_contents2 (Ergo issues a warning in such cases anyway).
(I know, I should document abolish_all_tables.)
--
--- michael
--
You received this message because you are subscribed to the Google Groups "ErgoAI and XSB Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ErgoAI-XSB-for...@coherentknowledge.com.
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-XSB-forum/a0db9d65-7ab5-4eb9-a7a8-52b776a1e5e2n%40coherentknowledge.com.
You received this message because you are subscribed to a topic in the Google Groups "ErgoAI and XSB Users Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/a/coherentknowledge.com/d/topic/ErgoAI-XSB-forum/lqIVjNjP5yE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ErgoAI-XSB-for...@coherentknowledge.com.
To view this discussion on the web visit https://groups.google.com/a/coherentknowledge.com/d/msgid/ErgoAI-XSB-forum/101cb636-c199-cc6f-6fc7-c3402f5decf0%40coherentknowledge.com.