bakaq / constrained.pl

Provides generalized versions of common Prolog predicates using constraints to make them more flexible and declarative.
The Unlicense
8 stars 2 forks source link

(#=..)/2 panic #13

Closed bakaq closed 1 year ago

bakaq commented 1 year ago
?- A = -1, A #=.. B.
   A = -1, B = [-1].
?- A #=.. B, A = -1.
thread 'main' panicked at 'index out of bounds: the len is 587318 but the index is 72057594037927935', src/machine/system_calls.rs:5461:9
bakaq commented 1 year ago

Seems it boils down to this:

?- T = -1, functor_c(T, F, N, A).
   T = -1, F = -1, N = 0, A = [].
?- functor_c(T, F, N, A), T = -1.
thread 'main' panicked at 'index out of bounds: the len is 622344 but the index is 72057594037927935', src/machine/system_calls.rs:5461:9
bakaq commented 1 year ago

Solved with using constraints in the definition of functor_c/4 so that it doesn't hit this bug.