I’m using: SWI-Prolog version threaded, 64 bits, version 9.2.2
I have the code:
combine_01_fast( LENGTH, LIST) :- LENGTH = 0, LIST = [], !.
combine_01_fast( LENGTH, LIST) :- true % LENGTH \== 0, LIST \== []
, LEN2 is LENGTH - 1
, LIST = [H|T]
, member( H, [ 0, 1])
, combine_01_fast( LEN2, T)
.
combine_01_fast_safe( LENGTH, LIST) :- length( LIST, LENGTH), combine_01_fast( LENGTH, LIST).
When I call the code:
?- TERM= combine_01_fast_safe( LEN, L), TERM, writeln( TERM), false.
Then I get:
combine_01_fast_safe(16,[1,0,0,1,1,0,0,1,0,1,1,1,0,0,0,0])
^C
Action (h for help) ? abort
% Execution Aborted
?-
or I land in the shell:
combine_01_fast_safe(15,[1,0,1,1,0,0,0,1,1,0,0,1,1,1,1])
^C
Action (h for help) ? abort
ox@debian64 2025-01-13 14:12:38:
~/dev-git/cnf_enumeration/swipl
(ins)$
I have no clue when it decides to end the prolog interpreter and when not.
Thanks in advance.