On Jun 6, 2012, at 5:59 PM, Kevin Livingston wrote:

> I was surprised to find that clojure.core.unify returns an exception
> when something does not unify rather than something like nil (false)
> when they don't. 

You can use core.logic's unifier:

user=> (require '[clojure.core.logic :as l])
user=> (l/unifier '[1 ?two 3 4] '[1 2 ?three 4])
[1 2 3 4]
user=> (l/unifier '[1 ?two 3 4] '[1 2 ?three NOT-FOUR])
nil

user=> (l/binding-map '[1 ?two 3 4] '[1 2 ?three 4])
{?three 3, ?two 2}

-----
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile
www.exampler.com, www.twitter.com/marick

-- 
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

Reply via email to