3 ms·
For a simple problem, the equivalent of one customer demand, something like n-queens, 'placements can't conflict', the difference isn't very large between Prolo
by cess11 2y ago
For a simple problem, the equivalent of one customer demand, something like n-queens, 'placements can't conflict', the difference isn't very large between Prolog and, say, Java.
https://www.metalevel.at/queens/ https://www.metalevel.at/queens/
https://leetcode-in-java.github.io/src/main/java/g0001_0100/s0051_n_queens/ https://leetcode-in-java.github.io/src/main/java/g0001_0100/...
That is, if you manage to figure out your own special case rule engine rather than a nest of if:s and for:s growing more organically.
If you have ten of these, e.g. more dimensions that would result in conflicts or constraints on where placement is possible in the domain, the Java (or PHP or JavaScript or whatever) solution is likely to turn out rather inscrutable. At least that's my experience in ERP and CRM-adjacent systems where I've spent considerable time figuring out and consolidating many years of piecemeal additions of constraint threading in things like planning and booking tasks and the like.
Sometimes I've scratched up algebraic expressions or standalone Prolog implementations to suss out what simpler code ought to look like.