Hi everyone.

About 6 months ago, I created a Constraint Programming library called 
CloCoP<https://github.com/aengelberg/clocop>. 
It was a Clojure wrapper for a Java library, and it mostly maintained the 
"imperative" propagation style. However, I was recently inspired to rework 
the library to have a more declarative, functional taste.

You can visit the github page <https://github.com/aengelberg/loco> for more 
details, but here is some sample code.
(use 'loco.core)
(use 'loco.constraints)
(defn solve-problem []
  (solution
    [($in :x 1 5)       ; x is between 1 and 5
     ($in :y 1 5)       ; y is between 1 and 5
     ($= ($+ :x 4) :y)] ; x + 4 = y
  ))
(solve-problem)
=> {:x 1, :y 5}

When you call a constraint function (that begins with a dollar sign), 
Clojure data is returned instead of a mysterious Java object.. The Java 
library underneath is now only accessed when the entire problem is passed 
to the "solution" function.

Loco is a good choice for speedily solving integer-domain problems. Let me 
know what you think of the new problem model; I believe that it allows for 
easier construction and manipulation of a model before solving it.

--Alex

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to