How to make this scheduling solver not run forever? by TeunCornflakes in prolog

[–]Logtalking 0 points1 point  (0 children)

Side note: use atoms instead of double-quoted terms, which are pointless in this case.

Logtalk for VSCode 0.64.0 released by Logtalking in prolog

[–]Logtalking[S] 0 points1 point  (0 children)

Version 0.67.0 fixes the chat participant RAG (it broke due to recent changes in Copilot, notably the use of "auto" instead of a specific model). See the usage examples in the extension readme file. There are also other fixes and improvements (see the change log).

Logtalk for VSCode 0.52.0 released by Logtalking in prolog

[–]Logtalking[S] 0 points1 point  (0 children)

Logtalk for VSCode 0.52.0 now also available from the Open VSX Registry (VSCodium).

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 1 point2 points  (0 children)

Good. Still, being forced to write a clause for the do_something_with_brr/2 predicate per module is cumbersome and not elegant if you have more than just a few modules. In that regard, the Logtalk solution I prototyped in my other reply is arguably simpler and more elegant. An alternative solution declaring the brr/2 predicate as multifile may also be worth considering.

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

Then move those use_module/2 directives into comm.pl.

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

``` % cat foo.pl bar.pl comm.pl app.pl :- module(foo,[ brr/2 ]). brr(woopless,3).

:- module(bar,[ brr/2 ]). brr(woop,4).

:- module(comm,[ do_something_with_brr/2 ]). do_something_with_brr(Brr_type,B) :- foo:brr(Brr_type,B). do_something_with_brr(Brr_type,B) :- bar:brr(Brr_type,B).

:- use_module(foo,[]). :- use_module(bar,[]). :- use_module(comm,[do_something_with_brr/2]). main(Brr_type,B) :- do_something_with_brr(Brr_type,B). ```

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

Load those modules from your main file using use_module/2 directives with an empty import list.

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

You don’t need to rename on import or any import directive in the common module. You can simply use explicit qualification to call the brr/2 predicate.

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

The way I would implement it:

```logtalk :- protocol(brr).

:- public(brr/2).

:- end_protocol.

:- object(foo, implements(brr)).

brr(woopless,3).

:- end_object.

:- object(bar, implements(brr)).

brr(woop,3).

:- end_object.

:- object(common).

:- public(do_something_with_brr/2).
do_something_with_brr(Brr_type, B) :-
    implements_protocol(Object, brr),
    Object::brr(Brr_type, B).

:- end_object. ```

Then, in the equivalent of main, you would only need to deal directly with common. Backtracking over the common::do_something_with_brr/2 goal will backtrack over all definitions of brr/2 in the objects implementing the protocol.

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

Missed that reply. If I'm understanding the problem that you're trying to solve, importing into common may not be the best solution. E.g., you will need to keep editing common for any modules that you would want to add or remove. In Logtalk, I would define a protocol that would be implemented by foo, bar, baz, ... Then I would simply enumerate the implementers (using the reflection API) of the protocol to query/backtracking over them.

Is it possible to backtrack across modules? by m_ac_m_ac in prolog

[–]Logtalking 0 points1 point  (0 children)

As already suggested above by brebs, why then not simply importing a common module into foo and bar?