O'Reilly logo

Clojure: High Performance JVM Programming by Akhil Wali, Shantanu Kumar, Eduardo Díaz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Thinking in logical relations

Now that we are well versed with the various constructs from the core.logic library, let's look at some real world problems that can be solved through logic programming.

Solving the n-queens problem

The n-queens problem is an interesting problem that can be implemented using logical relations. The objective of the n-queens problem is to place n queens on an n x n sized chessboard such that no two queens are a threat to each other. This problem is a generalization of the eight queens problem published by Max Bezzel in 1848, which involves eight queens. In fact, we can actually solve the n-queens problem for any number of queens, as long as we are dealing with four or more queens. Traditionally, this problem can be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required