Porting library(diadem) to Scryer Prolog
I am trying to port Ulrich Neumerkel's library(diadem) to Scryer Prolog for declarative debugging. The current state of the port is in the diadem branch at:
https://github.com/triska/scryer-prolog/tree/diadem
See specifically diadem.pl for the source.
So far, loading the library works:
?- use_module(library(diadem)). true.
However, trying the example from the source file, I get:
?- "caenum" = "caelum".?X. caught: error(existence_error(procedure,limes/4),limes/4)
Why? limes/4 is defined in the file, so this should work. (Update: resolved by adding a meta_predicate/1 declaration)
Update:
The current state of the issue is:
?- "caenum" = "caelum".?X. caught: error(existence_error(procedure,'$free_variable_set'/3),'$free_variable_set'/3)
@UWN: Could you please advise what is needed here, and what should be added to Scryer Prolog to emulate '$free_variable_set'/3 in a conforming system?
I see also that numbervars/4 is used by the library, should that be added to Scryer Prolog or is it possible to solve this differently?
I'm pretty sure limes/4 can't be found because if/3 isn't declared as a meta-predicate.
Ah yes, thank you a lot!
I now get:
$ scryer-prolog -f diadem.pl ?- "caenum" = "caelum".?X. thread 'main' panicked at 'Out of bounds access', src/machine/compile.rs:1666:41 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Update: The crash is now resolved.
Thank you, I have updated the initial description with the current state of the issue:
?- "caenum" = "caelum".?X. error(existence_error(procedure,'$free_variable_set'/3),'$free_variable_set'/3).