swipl-devel
swipl-devel copied to clipboard
Library yall usage with constraints behaves differently in repl and in file
The problem is described as 'disappointment 1' on line 35 of this file
https://github.com/smucclaw/sandbox/blob/273bf62d8bfc4ee25b501c283b1b86fe765ebab4/mengwong/advent2020/day01/part2.pl#L78
This fixes it by removing the yall call.
[12:42][debug] ?- solutionN("input.txt", 2020, 2, Answer). [12:42] Answer = [277,1743] ; [12:42] false. [12:42] solutionN(Filename, Sum, Cardinality, Answer) :- [12:42] readFile(Filename, Input), [12:42] length(Answer, Cardinality), [12:42] maplist(mbr(Input),Answer), [12:42] sum(Answer, #=, Sum), [12:42] sort(Answer,Answer). [12:42] mbr(Input, X) :- member(X, Input). [12:43] yall isn't playing nicely with clpfd
I'm unsure why this is an issue.
Code by Meng Weng Wong. Annie's awkward fix.