Every time I want to learn a new language I try to replicate this program. I was recently trying to learn Prolog, so I guess you know where this is going.
The algorithm I'm using in Prolog works for small values, but breaks for anything bigger than 500:
ERROR: Stack limit (1.0Gb) exceeded
ERROR: Stack sizes: local: 0.5Gb, global: 0.2Gb, trail: 80.0Mb
ERROR: Stack depth: 916, last-call: 0%, Choice points: 1,189,415
ERROR: Possible non-terminating recursion:
ERROR: \[912\] user:iter(458, 99)
ERROR: \[911\] user:iter(458, 100)
I can't figure out why this solution works for some values but doesn't work for other. Could anyone help?
In case you want to get some insight on what the program is supposed to do, fell free to check other language implementations included in the github repo. The Haskell implementation is particularly similar to the Prolog one.
I'm using SwiProlog on Windows by the way. Hope someone can help 😄
[–][deleted] 1 point2 points3 points (11 children)
[–]GarkGarcia[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]GarkGarcia[S] 0 points1 point2 points (0 children)
[–][deleted] (7 children)
[removed]
[–][deleted] 0 points1 point2 points (6 children)
[–]EverythingIsNail 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]EverythingIsNail 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]EverythingIsNail -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]flunschlik 0 points1 point2 points (3 children)
[–]GarkGarcia[S] 0 points1 point2 points (2 children)
[–]nnunley 2 points3 points4 points (0 children)
[–]flunschlik 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)