Expensive use of findall/3
Closed this issue · 2 comments
pmoura commented
The following goal is costly and a bad programming idiom:
Line 56 in 5fa2d56
This is reported by the Logtalk linter (git version) as:
* Suspicious call: findall(A,find_exp(B,C),D) instead of find_exp(B,C),fail;true
* while compiling object viterbi
* in file /Users/pmoura/Downloads/cplint-master/prolog/viterbi.pl between lines 48-62
As suggested in the warning message, using instead a (find_exp(B,C),fail;true)
goal is both clear and faster.
pmoura commented
That was fast! 🙂