rodnaph
rodnaph

Reputation: 1267

suitability for prolog problems

As a way to get started with core.logic I decided to work through 'Ninety-nine Prolog Problems' ...

https://github.com/rodnaph/99-core-logic-problems

But after only a few problems, from my current understanding it doesn't feel like core.logic is the right way to solve these problems (as they only require one answer).

I could be misunderstanding the relational approach, but am I barking up the wrong tree? Should I just use Prolog?

Cheers.

Upvotes: 2

Views: 202

Answers (1)

starblue
starblue

Reputation: 56792

The original problems are for Prolog, and in Prolog the relational approach is the only one you've got. Most of these problems are actually functional programming in disguise and don't make use of backtracking, so in Clojure it wouldn't be idiomatic to use core.logic for them.

That said, one of the neat things of Prolog is that you often can run them backwards (mostly the simple ones), to generate all possible solutions. For example, you can find all the ways to split a list into two parts by running append backwards.

Upvotes: 2

Related Questions