Reputation: 24613
Is it possible to do constraint logic programming in Racket? For example, can these problems be solved in Racket: http://people.sju.edu/~jhodgson/clp/howto_clpr.html or the SENDMORE problem on this page: https://en.wikibooks.org/wiki/Prolog/Constraint_Logic_Programming . I also could not find Racket and Scheme on these pages: https://en.wikipedia.org/wiki/Constraint_logic_programming and https://en.wikipedia.org/wiki/Constraint_programming
I see minikanren: http://io.livecode.ch/learn/webyrd/webmk and http://planet.racket-lang.org/package-source/dfriedman/miniKanren.plt/1/1/doc.txt and https://github.com/miniKanren/Racket-miniKanren but cannot find real examples.
Upvotes: 2
Views: 561
Reputation: 349
I believe the commenters have handled this question rather well. Racket is not itself a constraint logic programming language, but it is a programming-language programming language, and so it is a great substrate. There are a goodly number of ways to perform logic and constraint-logic programming within Racket, and the right approach for you might depend on the particular problems you're interested in solving and the kinds of constraints you are after.
I do not know of a CLP(R) system in Racket, but cryptarithmetic puzzles certainly can be solved with variants of miniKanren and probably other approaches.
I think the most important general answer to your question is that in Racket, even a "worst-case scenario" of needing to build a new language can be a pretty pleasant experience.
Upvotes: 1