<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions in core.logic</title>
<link>https://ask.clojure.org/index.php/questions/contrib-libs/core-logic</link>
<description></description>
<item>
<title>bug in core.logic with featurec searching for logic variables</title>
<link>https://ask.clojure.org/index.php/12427/bug-core-logic-with-featurec-searching-for-logic-variables</link>
<description>&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (def tmp {\a 1})
{\a 1}
user&amp;gt; (logic/run* [q] (logic/featurec tmp {\a q}))
(1)
user&amp;gt; (logic/run* [q] (logic/fresh [x] (logic/== x \a) (logic/featurec tmp {x q})))
()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The first logic search is as-expected. The second should return the same results as the first, but it instead fails.&lt;/p&gt;
&lt;p&gt;There are tests in core.logic that cover the other mode of featurec under fresh, ie: (logic/featurec {x q} tmp). But this mode, on the other hand, appears to not universally work.&lt;/p&gt;
&lt;p&gt;It was recommended I post this here as I am unable to create an account with access to the Jira to file this bug.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12427/bug-core-logic-with-featurec-searching-for-logic-variables</guid>
<pubDate>Sun, 04 Dec 2022 04:39:02 +0000</pubDate>
</item>
<item>
<title>core.logic problem</title>
<link>https://ask.clojure.org/index.php/11103/core-logic-problem</link>
<description>&lt;p&gt;Hi,&lt;br&gt;
I have encountered a problem in simple core.logic program:&lt;/p&gt;
&lt;p&gt;(require '[clojure.core.logic :as l]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;     '[clojure.core.logic.pldb :as db])
     
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(def facts&lt;br&gt;
  (db/db&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[In-zone 'A 'B]))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(println&lt;br&gt;
  (db/with-db facts&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    (l/run* [q]
      (l/fresh [x y]
        (In-zone x y)
        (== q 'IN-ZONE)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It gives this result:&lt;/p&gt;
&lt;p&gt;user=&amp;gt; (load-file &quot;../PROGS/CL/inzone.clj&quot;)&lt;br&gt;
CompilerException java.lang.ClassCastException: class clojure.core.logic.LVar cannot be cast to class java.lang.Number (clojure.core.logic.LVar is in unnamed module of loader clojure.lang.DynamicClassLoader @4d2015a9; java.lang.Number is in module java.base of loader 'bootstrap'), compiling:(/home/ru/clojure/core.logic-master/../PROGS/CL/inzone.clj:8:1)&lt;/p&gt;
&lt;p&gt;What's wrong? No mention about numbers!&lt;/p&gt;
&lt;p&gt;Thanks in advance for any help.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11103/core-logic-problem</guid>
<pubDate>Sat, 25 Sep 2021 11:18:29 +0000</pubDate>
</item>
<item>
<title>clojure.core.logic/project returning LVar instead of bound value</title>
<link>https://ask.clojure.org/index.php/10565/clojure-core-logic-project-returning-lvar-instead-bound-value</link>
<description>&lt;p&gt;I have a packing problem somewhat adjacent to the &quot;make change&quot; problem described and solved in &lt;a rel=&quot;nofollow&quot; href=&quot;https://blog.taylorwood.io/2018/05/10/clojure-logic.html&quot;&gt;this blog post by Taylor Wood&lt;/a&gt;.  Here is the code, transcribed with 1 addition:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns blah
  (:require [clojure.core.logic :refer :all :as l]
            [clojure.core.logic.fd :as fd]))

(defn productsumo [vars dens sum]
  (fresh [vhead vtail dhead dtail product run-sum]
    (conde
     [(emptyo vars) (== sum 0)]
     [(conso vhead vtail vars)
      (conso dhead dtail dens)
      (project [vhead]
        (do (println vhead) succeed))  ;;&amp;lt;--- Just a lame goal that should print out the head..
      (fd/* vhead dhead product)
      (fd/+ product run-sum sum)
      (productsumo vtail dtail run-sum)])))

(defn change [amount denoms]
  (let [dens (sort &amp;gt; denoms)
        vars (repeatedly (count dens) lvar)]
    (run* [q]
      ;; we want a map from denominations to their quantities
      (== q (zipmap dens vars))
      ;; prune problem space...
      ;; every var/quantity must be 0 &amp;lt;= n &amp;lt;= amount
      (everyg #(fd/in % (fd/interval 0 amount)) vars)
      ;; the real work
      (productsumo vars dens amount))))

user&amp;gt; (change 14 #{1 5 10})
&amp;lt;lvar:81678&amp;gt;
&amp;lt;lvar:81679&amp;gt;
&amp;lt;lvar:81680&amp;gt;
({10 0, 5 0, 1 14} {10 1, 5 0, 1 4} {10 0, 5 1, 1 9} {10 0, 5 2, 1 4})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When run, instead of getting the projected or current value of the LVar &lt;code&gt;vhead&lt;/code&gt;, as I expect and have normally seen when I use &lt;code&gt;project&lt;/code&gt;, I get the Lvar.  Are there any ideas why this is the case?  &lt;/p&gt;
&lt;p&gt;My specific use case is a modification of productsumo, where I have a map of key-&amp;gt;weight that I need to use in liue of the coll &lt;code&gt;dens&lt;/code&gt; that is here.  My initial approach - which seems reasonable - is to use &lt;code&gt;project&lt;/code&gt; as above to unify a cost LVar based off the current value of &lt;code&gt;vhead&lt;/code&gt;, and then use that in the product computation.  Currently I keep getting back LVars instead of values.&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10565/clojure-core-logic-project-returning-lvar-instead-bound-value</guid>
<pubDate>Wed, 05 May 2021 07:18:08 +0000</pubDate>
</item>
<item>
<title>Memoization in core.logic</title>
<link>https://ask.clojure.org/index.php/9905/memoization-in-core-logic</link>
<description>&lt;p&gt;I'm solving a sub-part of my problem using &lt;code&gt;core.logic&lt;/code&gt;. I'm anticipating that the declarative nature of describing the problem would lead to poor performance on large inputs.&lt;/p&gt;
&lt;p&gt;But the setup I have is that the inputs to core.logic rarely change, but I query them a lot. So naturally I think that memoization would speed up the performance.&lt;/p&gt;
&lt;p&gt;I could only memoize the results from top-level &lt;code&gt;(l/run*&lt;/code&gt; form, but again that's less efficient than memoizing at every &lt;code&gt;l/defne&lt;/code&gt; or at every call to &lt;code&gt;conde&lt;/code&gt;, because the latter can give the same speedups as dynamic-programming does.&lt;/p&gt;
&lt;p&gt;But I do not understand what kind of values (like &lt;code&gt;LVar&lt;/code&gt;s introduced by fresh) pass between the logical clauses. They are different from regular clojure values, and I have never even called one of the clauses (like &lt;code&gt;l/==&lt;/code&gt; or &lt;code&gt;l/membero&lt;/code&gt;) &quot;normally&quot;. They are always called indirectly by &lt;code&gt;l/run*&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So, do I need to do anything special if I want to memoize such &lt;code&gt;defne&lt;/code&gt;s?&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9905/memoization-in-core-logic</guid>
<pubDate>Sun, 29 Nov 2020 08:07:28 +0000</pubDate>
</item>
<item>
<title>Can core.logic reason about sets?</title>
<link>https://ask.clojure.org/index.php/9889/can-core-logic-reason-about-sets</link>
<description>&lt;p&gt;&lt;code&gt;l/membero&lt;/code&gt; lets you relate list-items and lists, but I did not find an equivalent method in &lt;code&gt;core.logic&lt;/code&gt; for &lt;code&gt;contains?&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I'm currently converting my set to a list to use with &lt;code&gt;l/membero&lt;/code&gt;, but I was just wondering -- is it possible to reason about sets in general with &lt;code&gt;core.logic&lt;/code&gt;? e.g. relating two sets and their union, and other common operations?&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9889/can-core-logic-reason-about-sets</guid>
<pubDate>Fri, 27 Nov 2020 19:57:39 +0000</pubDate>
</item>
<item>
<title>If a map is a coll, why can't conso take its first element?</title>
<link>https://ask.clojure.org/index.php/8895/if-a-map-is-a-coll-why-cant-conso-take-its-first-element</link>
<description>&lt;p&gt;Looking into conso's documentation, it seems that maps are not being properly considered as collections:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (coll? {:a 1}) ; Just for context
true
user&amp;gt; (first {:a 1})
[:a 1]
user&amp;gt; (run* [p q] (conso p q {:a 1})) ; This is the surprising part
()
user&amp;gt; (run* [p q] (conso p q [[:a 1]])) ; For comparison
([[:a 1] ()])
user&amp;gt; (doc conso) ; Docs talk about collection as expected input
-------------------------
clojure.core.logic/conso
([a d l])
  A relation where l is a collection, such that a is the first of l
  and d is the rest of l. If ground d must be bound to a proper tail.
nil
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;EDIT: Also doesn't work for sets:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user&amp;gt; (run* [p q] (conso p q #{1 3}))
()
user&amp;gt; (first #{1 3})
1
user&amp;gt; (coll? #{1 3})
true
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8895/if-a-map-is-a-coll-why-cant-conso-take-its-first-element</guid>
<pubDate>Sun, 24 Nov 2019 20:29:56 +0000</pubDate>
</item>
<item>
<title>lein deps and lein classpath fail for current core.logic, where to report?</title>
<link>https://ask.clojure.org/index.php/8831/lein-deps-lein-classpath-fail-current-core-logic-where-report</link>
<description>&lt;p&gt;With the most recent commit to core.logic (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.logic/commit/bd325069d9ded1612515d15ad578d588094a47f7&quot;&gt;https://github.com/clojure/core.logic/commit/bd325069d9ded1612515d15ad578d588094a47f7&lt;/a&gt;), &lt;code&gt;lein deps&lt;/code&gt; and &lt;code&gt;lein classpath&lt;/code&gt; do not successfully complete here.&lt;/p&gt;
&lt;p&gt;Commenting out a portion of project.clj having to do with cider-nrepl leads both to at least finish.&lt;/p&gt;
&lt;p&gt;When I asked on slack's #core.logic about this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;commenting out the [cider/cider-nrepl &quot;0.8.1&quot;] portion of project.clj alows those commands to complete...&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;dpsutton responded with:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;that's over four years old and from a time when cider wouldn't auto-inject its own dependencies. it should be removed&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I don't know if it's an appropriate change, but it seems like something should change.&lt;/p&gt;
&lt;p&gt;It wasn't clear to me where to report this, but was advised by dpsutton and seancorfield to try here.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Truncated example output (this form refused the full content) for lein deps below.&lt;/p&gt;
&lt;pre&gt;
$ lein deps
clojure.lang.Compiler$CompilerException: Syntax error compiling at (cider/nrepl.clj:1:1).
#:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source &quot;cider/nrepl.clj&quot;}
 at clojure.lang.Compiler.load (Compiler.java:7647)
    clojure.lang.RT.loadResourceScript (RT.java:381)
    clojure.lang.RT.loadResourceScript (RT.java:372)
    clojure.lang.RT.load (RT.java:463)
    clojure.lang.RT.load (RT.java:428)
    clojure.core$load$fn__6824.invoke (core.clj:6126)
    clojure.core$load.invokeStatic (core.clj:6125)
    clojure.core$load.doInvoke (core.clj:6109)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.core$load_one.invokeStatic (core.clj:5908)
    clojure.core$load_one.invoke (core.clj:5903)
    clojure.core$load_lib$fn__6765.invoke (core.clj:5948)
    clojure.core$load_lib.invokeStatic (core.clj:5947)
    clojure.core$load_lib.doInvoke (core.clj:5928)
    clojure.lang.RestFn.applyTo (RestFn.java:142)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$load_libs.invokeStatic (core.clj:5985)
    clojure.core$load_libs.doInvoke (core.clj:5969)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$require.invokeStatic (core.clj:6007)
    clojure.core$require.doInvoke (core.clj:6007)
    clojure.lang.RestFn.invoke (RestFn.java:421)
&lt;/pre&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8831/lein-deps-lein-classpath-fail-current-core-logic-where-report</guid>
<pubDate>Tue, 05 Nov 2019 22:00:30 +0000</pubDate>
</item>
<item>
<title>The order of constraits matters?</title>
<link>https://ask.clojure.org/index.php/7267/the-order-of-constraits-matters</link>
<description>&lt;p&gt;The Wiki page (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer#corelogic-is-declarative&quot;&gt;https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer#corelogic-is-declarative&lt;/a&gt;) says &quot;...the order of constraints does not matter as far as the value of the (run*  ...) expression is concerned.&quot; But I tried this example of Sudoku solver (&lt;a rel=&quot;nofollow&quot; href=&quot;https://gist.github.com/orb/5884956&quot;&gt;https://gist.github.com/orb/5884956&lt;/a&gt;) and found that if you exchange these two lines:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(everyg #(fd/in % sdnum) board)
(init-board board puzzle)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;{{core.logic}} will freeze and never return the answer.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7267/the-order-of-constraits-matters</guid>
<pubDate>Wed, 28 Nov 2018 10:59:41 +0000</pubDate>
</item>
<item>
<title>EQ conditions which match against a negative result fail to find any results.</title>
<link>https://ask.clojure.org/index.php/7247/conditions-which-match-against-negative-result-fail-results</link>
<description>&lt;p&gt;I was trying to follow the example provided by (link: this blog post)(&lt;a rel=&quot;nofollow&quot; href=&quot;https://mattsenior.com/2014/02/using-clojures-core-logic-to-solve-simple-number-puzzles&quot;&gt;https://mattsenior.com/2014/02/using-clojures-core-logic-to-solve-simple-number-puzzles&lt;/a&gt;) and found that it only worked if I removed the conditions that test for subtraction with a negative result. I removed a lot of different things and found that even this basic example does not find any matches:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(ns example.core&lt;br&gt;
  (:refer-clojure :exclude (link: ==))&lt;br&gt;
  (:require (link: clojure.core.logic :refer :all))&lt;br&gt;
  (:require (link: clojure.core.logic.fd :as fd)))&lt;/p&gt;
&lt;p&gt;(run*  (link: q)&lt;br&gt;
  (fresh (link: a0 a1)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(== q (link: a0 a1))
(fd/in a0 a1 (fd/interval 1 9))
(fd/- a0 a1 -1)
;(fd/eq
;  (= (- a0 a1) -1))
))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Dependencies (though I tried clojure 1.8 and 1.9 too):&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
:dependencies (link: [org.clojure/clojure &quot;1.7.0&quot;)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;             (link: org.clojure/core.logic &quot;0.8.11&quot;)]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7247/conditions-which-match-against-negative-result-fail-results</guid>
<pubDate>Sun, 04 Nov 2018 19:24:19 +0000</pubDate>
</item>
<item>
<title>*locals* is unbound in some calls to `p-&gt;term`</title>
<link>https://ask.clojure.org/index.php/7254/locals-is-unbound-in-some-calls-to-p-term</link>
<description>&lt;p&gt;Some pattern-matching expressions that should work fail, because the dynamic variable &lt;code&gt;**locals**&lt;/code&gt; is not bound. For example:&lt;/p&gt;
&lt;p&gt;(matche&lt;br&gt;
  (link: x)&lt;br&gt;
  ((link: '(~a))))&lt;/p&gt;
&lt;p&gt;gives an error during macroexpansion, that &lt;code&gt;contains?&lt;/code&gt; cannot be applied to an unbound variable:&lt;/p&gt;
&lt;p&gt;CompilerException java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.Var$Unbound&lt;/p&gt;
&lt;p&gt;(The referenced call to contains? is in lvar-sym?, where we check whether a variable that appears within a pattern is already a local variable.)&lt;/p&gt;
&lt;p&gt;I believe this is what is happening:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;At two places in &lt;code&gt;p-&amp;gt;term&lt;/code&gt;, we call &lt;code&gt;map&lt;/code&gt; to apply p-&amp;gt;term recursively to subpatterns: &lt;code&gt;(map #(p-&amp;gt;term % vars quoted) p)&lt;/code&gt;, for example.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;map&lt;/code&gt; returns a LazySeq.&lt;/li&gt;
&lt;li&gt;By the time the elements of the LazySeq are actually forced (this happens during macro expansion), the dynamic &lt;strong&gt;locals&lt;/strong&gt; variable is no longer bound.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;One solution might be to wrap a &lt;code&gt;(doall ...)&lt;/code&gt; around the two calls to &lt;code&gt;map&lt;/code&gt; mentioned above (lines 1523 and 1529 of logic.clj).&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7254/locals-is-unbound-in-some-calls-to-p-term</guid>
<pubDate>Thu, 27 Sep 2018 17:56:55 +0000</pubDate>
</item>
<item>
<title>spurious disequality constraints</title>
<link>https://ask.clojure.org/index.php/7269/spurious-disequality-constraints</link>
<description>&lt;p&gt;As reported by Will Byrd:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(is (=&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (run* [q]
   (fresh [x y]
     (!= (list x y) q)))
 ;; Simplified answer should just be:
 ;;
 ;; (_0)
 ;;
 ;; There is no way to violate this constraint, since neither
 ;; _1 nor _2 is reified. Both would need to be reified to be
 ;; able to violate the constraint.
 '((_0 :- (!= (_0 (_1 _2)))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I have a suggested fix here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.logic/compare/master...namin:fix-for-meta?expand=1&quot;&gt;https://github.com/clojure/core.logic/compare/master...namin:fix-for-meta?expand=1&lt;/a&gt;&lt;br&gt;
but might be worth ensuring that other test cases from mk also work as intended.&lt;/p&gt;
&lt;p&gt;Will Byrd suggests converting this file of tests:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/webyrd/faster-miniKanren/blob/master/disequality-tests.scm&quot;&gt;https://github.com/webyrd/faster-miniKanren/blob/master/disequality-tests.scm&lt;/a&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7269/spurious-disequality-constraints</guid>
<pubDate>Wed, 24 Jan 2018 05:56:07 +0000</pubDate>
</item>
<item>
<title>finite domain uncomplete results</title>
<link>https://ask.clojure.org/index.php/7276/finite-domain-uncomplete-results</link>
<description>I was trying to implement a relation similar to (map + list1 list2) -&amp;gt; list3&lt;br /&gt;
My code is: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(require '[clojure.core.logic :as l])&lt;br /&gt;
(require '[clojure.core.logic.fd :as fd])&lt;br /&gt;
&lt;br /&gt;
(defn zip+o [x y z]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(l/conde&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[(l/== () x) (l/== () y) (l/== () z)]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[(l/fresh [fx rx fy ry fz rz]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(l/conso fx rx x)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(l/conso fy ry y)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(l/conso fz rz z)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fd/in fx fy fz (fd/interval 10))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fd/+ fx fy fz)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(zip+o rx ry rz))]))&lt;br /&gt;
&lt;br /&gt;
(def expected-solutions&lt;br /&gt;
&amp;nbsp;&amp;nbsp;#{{:x [0 0] :y [1 1]}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:x [0 1] :y [1 0]}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:x [1 1] :y [0 0]}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{:x [1 0] :y [0 1]}})&lt;br /&gt;
&lt;br /&gt;
(l/run* [q]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(l/fresh [x y]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(l/== q {:x x :y y})&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(zip+o x y [1 1])))&lt;br /&gt;
&lt;br /&gt;
;=&amp;gt; ({:x (1 0), :y (0 1)}&lt;br /&gt;
; &amp;nbsp;&amp;nbsp;&amp;nbsp;{:x (0 0), :y (1 1)})&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I've manage to get the expected behavior (I think...) by removing the call to onceo in clojure.core.logic/enforce-constraints&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(defn enforce-constraints [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(all&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;(force-ans x)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;(fn [a]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(let [constrained (enforceable-constrained a)]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(verify-all-bound a constrained)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;((force-ans constrained) a) ;; &amp;nbsp;&amp;lt;--- Here&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;#_((onceo (force-ans constrained)) a)))))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sadly it breaks one test...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
FAIL in (test-simplefd-in-last) (tests.clj:1797)&lt;br /&gt;
expected: (= (run* [q] (fresh [x y z p0 p1] (== q [x y]) (fd/+ x y 9) (fd/* x 2 p0) (fd/* y 4 p1) (fd/+ p0 p1 24) (fd/in x y z (fd/interval 0 9)))) (quote ([6 3])))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;actual: (not (= ([6 3] [6 3] [6 3] [6 3] [6 3] [6 3] [6 3] [6 3] [6 3] [6 3]) ([6 3])))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope it will at least help you to find the real problem.</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7276/finite-domain-uncomplete-results</guid>
<pubDate>Wed, 01 Nov 2017 10:15:40 +0000</pubDate>
</item>
<item>
<title>The extension of IDisunifyTerms to LCons calls seq on lcons values. LCons doesn't implement ISeq</title>
<link>https://ask.clojure.org/index.php/7287/extension-idisunifyterms-lcons-calls-values-doesnt-implement</link>
<description>&lt;p&gt;I don't have a good repro case for this, I hit the issue in the middle of some other code.&lt;/p&gt;
&lt;p&gt;on like 2332 or so of master you have some code like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(cond&lt;br&gt;
...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (lcons? v)
  (loop [u u v (seq v) cs cs]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;...&lt;br&gt;
)&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is obviously incorrect, because anything that returns true to lcons? will throw an exception with you call seq on it.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7287/extension-idisunifyterms-lcons-calls-values-doesnt-implement</guid>
<pubDate>Thu, 20 Apr 2017 01:54:40 +0000</pubDate>
</item>
<item>
<title>An lvar unified with a keyword behaves differently from a keyword</title>
<link>https://ask.clojure.org/index.php/7275/lvar-unified-with-keyword-behaves-differently-from-keyword</link>
<description>(run 1 [q]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fresh [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== x :a)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== q ({:a 0} x))))&lt;br /&gt;
=&amp;gt; (nil)&lt;br /&gt;
(run 1 [q]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fresh [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== x :a)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== q ({:a 0} :a))))&lt;br /&gt;
=&amp;gt; (0)&lt;br /&gt;
(run 1 [q]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fresh [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== x :a)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== {:a 0} {x q})))&lt;br /&gt;
=&amp;gt; ()&lt;br /&gt;
(run 1 [q]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fresh [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== x :a)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== {:a 0} {:a q})))&lt;br /&gt;
=&amp;gt; (0)</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7275/lvar-unified-with-keyword-behaves-differently-from-keyword</guid>
<pubDate>Mon, 16 Jan 2017 01:39:12 +0000</pubDate>
</item>
<item>
<title>Running rembero returns  :- (!= _0 _0)</title>
<link>https://ask.clojure.org/index.php/7274/running-rembero-returns-0-0</link>
<description>&lt;p&gt;(run*  (link: out)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (fresh (link: y z)
         (rembero y (list 'a 'b y 'd z 'e) out)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;=&amp;gt;&lt;br&gt;
((b a d _0 e)&lt;br&gt;
 (a b d _0 e)&lt;br&gt;
 ((a b d _0 e) :- (!= (_1 b)) (!= (_1 a)))&lt;br&gt;
 ((a b _0 d e) :- (!= (_0 _0)) (!= (_0 b)) ((image: = (_0 d)) ()= (_0 a))))&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7274/running-rembero-returns-0-0</guid>
<pubDate>Tue, 06 Dec 2016 23:02:01 +0000</pubDate>
</item>
<item>
<title>spec detects error in -inc macro</title>
<link>https://ask.clojure.org/index.php/7265/spec-detects-error-in-inc-macro</link>
<description>As reported on the Clojure mailing list by Burt:&lt;br /&gt;
&lt;br /&gt;
with &amp;quot;1.9.0-alpha10&amp;quot; and core.logic &amp;quot;0.8.10&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
(ns lwb.nd.rules&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(:refer-clojure :exclude [==])&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(:require [clojure.core.logic :refer :all]))&lt;br /&gt;
=&amp;gt; nil&lt;br /&gt;
&lt;br /&gt;
with &amp;quot;1.9.0-alpha12&amp;quot; and core.logic &amp;quot;0.8.10&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
(ns lwb.nd.rules&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(:refer-clojure :exclude [==])&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(:require [clojure.core.logic :refer :all]))&lt;br /&gt;
CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/fn did not conform to spec:&lt;br /&gt;
In: [0] val: clojure.core.logic/-inc fails spec: :clojure.core.specs/arg-list at: [:args :bs :arity-1 :args] predicate: vector?&lt;br /&gt;
In: [0] val: clojure.core.logic/-inc fails spec: :clojure.core.specs/args+body at: [:args :bs :arity-n] predicate: (cat :args :clojure.core.specs/arg-list :prepost (? map?) :body (* any?))&lt;br /&gt;
:clojure.spec/args &amp;nbsp;(clojure.core.logic/-inc [] (bind (this) g))&lt;br /&gt;
&amp;nbsp;#:clojure.spec{:problems ({:path [:args :bs :arity-1 :args], :pred vector?, :val clojure.core.logic/-inc, :via [:clojure.core.specs/args+body :clojure.core.specs/arg-list :clojure.core.specs/arg-list], :in [0]} {:path [:args :bs :arity-n], :pred (cat :args :clojure.core.specs/arg-list :prepost (? map?) :body (* any?)), :val clojure.core.logic/-inc, :via [:clojure.core.specs/args+body :clojure.core.specs/args+body], :in [0]}), :args (clojure.core.logic/-inc [] (bind (this) g))}, compiling:(clojure/core/logic.clj:1130:5)</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7265/spec-detects-error-in-inc-macro</guid>
<pubDate>Tue, 13 Sep 2016 18:51:48 +0000</pubDate>
</item>
<item>
<title>Document how defn/implicit do with multiple goals does not work</title>
<link>https://ask.clojure.org/index.php/7270/document-how-defn-implicit-with-multiple-goals-does-not-work</link>
<description>Hi! I have a small documentation improvement proposal: &lt;br /&gt;
&lt;br /&gt;
When using regular `defn` to create a relation, I've found that an empty {{(fresh [] ...)}} is needed if you want to use multiple relations and goals inside your defn:ed relation, otherwise your goals are in the implicit do from defn, and only the last one has any effect.&lt;br /&gt;
&lt;br /&gt;
Simple example:&lt;br /&gt;
&lt;br /&gt;
{{ &lt;br /&gt;
defn-logic&amp;gt; (defn test [a b]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== a 1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== b 2))&lt;br /&gt;
#'defn-logic/test&lt;br /&gt;
defn-logic&amp;gt; (run* [q] (fresh [a b]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== q [a b])&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(test a b)))&lt;br /&gt;
([_0 2])&lt;br /&gt;
defn-logic&amp;gt; (defn test [a b]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fresh []&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== a 1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== b 2)))&lt;br /&gt;
#'defn-logic/test&lt;br /&gt;
defn-logic&amp;gt; (run* [q] (fresh [a b]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== q [a b])&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(test a b)))&lt;br /&gt;
([1 2])&lt;br /&gt;
defn-logic&amp;gt; &lt;br /&gt;
}} &lt;br /&gt;
&lt;br /&gt;
Again, this is perfectly correct and reasonable, but maybe a bit confusing for beginners, in that the implicit do &amp;quot;fails silently&amp;quot;. What I'm looking for here is probably just a heads up in the Wiki docs. I couldn't find it, but maybe it exists already? I'd be happy to add it to the documentation and send a PR.</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7270/document-how-defn-implicit-with-multiple-goals-does-not-work</guid>
<pubDate>Fri, 05 Aug 2016 12:01:05 +0000</pubDate>
</item>
<item>
<title>Example of unifier on wiki uses wrong syntax?</title>
<link>https://ask.clojure.org/index.php/7262/example-of-unifier-on-wiki-uses-wrong-syntax</link>
<description>The example of clojure.core.logic.unifier/unifier on the Features wiki page is&lt;br /&gt;
&lt;br /&gt;
(unifier '(?x ?y ?z) '(1 2 ?y)) ; (1 2 _.0)&lt;br /&gt;
&lt;br /&gt;
Shouldn't it be something like&lt;br /&gt;
&lt;br /&gt;
(unifier ['(?x ?y ?z) '(1 2 ?y)]) ; {?y 2, ?x 1, ?z 2}&lt;br /&gt;
&lt;br /&gt;
?</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7262/example-of-unifier-on-wiki-uses-wrong-syntax</guid>
<pubDate>Mon, 11 Jan 2016 23:43:28 +0000</pubDate>
</item>
<item>
<title>binding to a deep nested vector takes too much time</title>
<link>https://ask.clojure.org/index.php/7258/binding-to-a-deep-nested-vector-takes-too-much-time</link>
<description>&lt;p&gt;It's probably related to how core.logic is printing out the vector structure&lt;/p&gt;
&lt;p&gt;Following is minimal case to reproduce the issue&lt;/p&gt;
&lt;p&gt;(ns testclj.logic&lt;br&gt;
  (:require (link: clojure.core.logic :as l)))&lt;/p&gt;
&lt;p&gt;(def data (link: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[:a)]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])&lt;/p&gt;
&lt;p&gt;(time (l/run*  (link: q) (l/== q data)))&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7258/binding-to-a-deep-nested-vector-takes-too-much-time</guid>
<pubDate>Thu, 24 Dec 2015 11:34:11 +0000</pubDate>
</item>
<item>
<title>Extending IUnifyTerms doesn't work anymore</title>
<link>https://ask.clojure.org/index.php/7253/extending-iunifyterms-doesnt-work-anymore</link>
<description>&lt;p&gt;The procedure as described on &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/core.logic/wiki/Extending-core.logic-%28Datomic-example%29&quot;&gt;https://github.com/clojure/core.logic/wiki/Extending-core.logic-(Datomic-example)&lt;/a&gt; doesn't work anymore. Clojure complains that IUnifyTerms &quot;isn't a protocol&quot; (even though it clearly is).&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7253/extending-iunifyterms-doesnt-work-anymore</guid>
<pubDate>Wed, 16 Dec 2015 18:39:40 +0000</pubDate>
</item>
<item>
<title>Disequality might not eliminate when `(!= (_0 _0))`</title>
<link>https://ask.clojure.org/index.php/7245/disequality-might-not-eliminate-when-0-0</link>
<description>&lt;p&gt;When a unification constraint and a disequality constraint are applied to the same lvars they might eliminate possibilities.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run 1 [q]&lt;br&gt;
 (fresh [v n]&lt;br&gt;
   (== q v)&lt;br&gt;
   (!= q v)))&lt;/p&gt;
&lt;p&gt;;=&amp;gt; ()&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;However when a separate disequality is interleaved the possibility is not eliminated.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run 1 [q]&lt;br&gt;
  (fresh [v n]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(== q v)
(!= q n)
(!= q v)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;=&amp;gt; ((_0 :- (!= (_0 _0)) (!= (_0 _1))))&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I expected this to also return '().&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7245/disequality-might-not-eliminate-when-0-0</guid>
<pubDate>Sun, 06 Dec 2015 02:24:09 +0000</pubDate>
</item>
<item>
<title>LCons fails for inequality</title>
<link>https://ask.clojure.org/index.php/7263/lcons-fails-for-inequality</link>
<description>&lt;p&gt;The following expression results in an Exception &quot;IllegalArgumentException Don't know how to create ISeq from: clojure.core.logic.LCons  clojure.lang.RT.seqFrom (RT.java:505)&quot;, but should return ().&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run 1 (link: q)&lt;br&gt;
  (!= (lcons 1 1) (lcons 1 1)))&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7263/lcons-fails-for-inequality</guid>
<pubDate>Tue, 11 Aug 2015 21:03:02 +0000</pubDate>
</item>
<item>
<title>StackOverflowError when logic variable is unified with a set</title>
<link>https://ask.clojure.org/index.php/7246/stackoverflowerror-when-logic-variable-is-unified-with-set</link>
<description>&lt;p&gt;It is pretty common to unify a variable with a vector or list of a fixed length like {{(== q (list a b))}} and then define more goals on {{a}} and {{b}} with the intention of being able to define the                         *   query's result format.  However, if one does the same using a set one gets a StackOverflowError.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run* [q]&lt;br&gt;
  (fresh [a b]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(== q #{a b})  ;; StackOverflowError
;;(== q [a b]) ;; works
;;(== q (list a b)) ;; works, too
(conde [(== a 1)] [(== a 2)] [(== a 3)])
(conde [(== b 1)] [(== b 2)] [(== b 3)])))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Basically, what I wanted to express here is that the order of {{a}} and {{b}} is not significant so that                                                                                         *  } gives me the unique results.&lt;/p&gt;
&lt;p&gt;The backtrace is:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;                 logic.clj:  231  clojure.core.logic/walk*/fn
                 logic.clj:  984  clojure.core.logic/eval8917/fn
             protocols.clj:   55  clojure.core.logic.protocols/eval7398/fn/G
                 logic.clj:  229  clojure.core.logic/walk*
                 logic.clj:  233  clojure.core.logic/walk*/fn
                 logic.clj:  984  clojure.core.logic/eval8917/fn
             protocols.clj:   55  clojure.core.logic.protocols/eval7398/fn/G
                 logic.clj:  229  clojure.core.logic/walk*
                 logic.clj:  233  clojure.core.logic/walk*/fn
                 logic.clj:  984  clojure.core.logic/eval8917/fn
             protocols.clj:   55  clojure.core.logic.protocols/eval7398/fn/G
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;[...]&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7246/stackoverflowerror-when-logic-variable-is-unified-with-set</guid>
<pubDate>Mon, 03 Aug 2015 09:58:47 +0000</pubDate>
</item>
<item>
<title>nafc doesn't work with more complex goals</title>
<link>https://ask.clojure.org/index.php/7285/nafc-doesnt-work-with-more-complex-goals</link>
<description>&lt;p&gt;The negation as failure constraint {{nafc}} is supposed to succeed if and only if the goal provided by a relation and its args fails.  The test cases just cover very simple cases like {{(nafc == q 'b)}} which is essentially equivalent to &lt;code&gt;(!= q 'b)&lt;/code&gt; (at least to my understanding).  But with a slightly more complex case, it doesn't seem to work anymore.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run* [q]&lt;br&gt;
  (fresh [a b]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(== q (list a b))
(fd/in a b (fd/interval 1 3)) ;; fd is an alias for clojure.core.logic.fd
(fd/&amp;lt; a b)
(nafc membero 2 q)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;=&amp;gt; ((1 2) (2 3) (1 3))&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The constraint specifies that the number 2 must NOT be contained in the list {{q}} but still it is.  I expected to get the single answer {{(1 3)}} here.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7285/nafc-doesnt-work-with-more-complex-goals</guid>
<pubDate>Fri, 31 Jul 2015 08:27:26 +0000</pubDate>
</item>
<item>
<title>The docstring of condu is incorrect or at least confusing</title>
<link>https://ask.clojure.org/index.php/7243/the-docstring-of-condu-is-incorrect-or-at-least-confusing</link>
<description>&lt;p&gt;The docstring of {{condu}} reads&lt;/p&gt;
&lt;p&gt;{quote}&lt;br&gt;
Committed choice. Once the head (first goal) of a clause has succeeded, remaining goals of the clause will only be run once. Non-relational.&lt;br&gt;
{quote}&lt;/p&gt;
&lt;p&gt;The sentence with respect to the once-semantics isn't correct. The head (first goal) can succeed at most once whereas the remaining goals of the clause committed to can succeed an unbounded number of times. The following example demonstrates that.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(defn y-or-n [x]&lt;br&gt;
  (conde&lt;br&gt;
   [(== x :y)]&lt;br&gt;
   [(== x :n)]))&lt;/p&gt;
&lt;p&gt;(run* [x y]&lt;br&gt;
  (condu&lt;br&gt;
   [(y-or-n x) (== y 1)] ;; (y-or-n x) succeeds once because it's the head goal&lt;br&gt;
   [(== x :y) (== y 2)]))&lt;br&gt;
;;=&amp;gt; ([:y 1])&lt;/p&gt;
&lt;p&gt;(run* [x y]&lt;br&gt;
  (condu&lt;br&gt;
   [(== y 1) (y-or-n x)] ;; (y-or-n x) succeeds twice because it's not the head goal&lt;br&gt;
   [(== x :y) (== y 2)]))&lt;br&gt;
;;=&amp;gt; ([:y 1] [:n 1])&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The current behavior shown in the example is in compliance with miniKanren on Scheme, so it's just the docstring which isn't right.  The implementation is correct.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7243/the-docstring-of-condu-is-incorrect-or-at-least-confusing</guid>
<pubDate>Tue, 28 Jul 2015 12:00:01 +0000</pubDate>
</item>
<item>
<title>Replacing Marker Interfaces</title>
<link>https://ask.clojure.org/index.php/7257/replacing-marker-interfaces</link>
<description>*Summary:* There is a pattern of {{(definterface IFoo)}} and subsequent uses of {{IFoo}} as a type marker for efficient {{(instance? IFoo x)}} checks. This pattern is not platform agnostic and could potentially block improving support for core.logic on CLJS (which does not support {{definterface}} according to [&lt;a href=&quot;http://dev.clojure.org/jira/browse/CLJS-1190&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://dev.clojure.org/jira/browse/CLJS-1190&lt;/a&gt;]).&lt;br /&gt;
&lt;br /&gt;
*Background:*&lt;br /&gt;
I was investigating the possibility of using reader conditionals to port parts of core.logic to CLJS (specifically: core.logic.fd) and noticed the usage of interfaces as type markers.&lt;br /&gt;
&lt;br /&gt;
The problem with this is that there is no {{definterface}} in CLJS (to my knowledge; attempting to run {{(definterface IFoo)}} fails in a CLJS repl but works in a CLJ repl).&lt;br /&gt;
&lt;br /&gt;
I have started trying to look for a platform-agnostic replacement for the marker interface pattern but wanted to know if there were specific reasons that this pattern was used before diving into actual coding. I also wanted to know if there were already plans to replace this pattern.&lt;br /&gt;
&lt;br /&gt;
*Remediation:*&lt;br /&gt;
Ideally a cross-platform method for achieving this could be implemented. If not, then an alternative method could be defined for and used by CLJS at the cost of some performance.&lt;br /&gt;
&lt;br /&gt;
A possible change would be to replace the marker interfaces with marker protocols, and the instances of {{instance?}} with instances of {{satisfies?}}.&lt;br /&gt;
&lt;br /&gt;
The following seem to be equivalent in Clojure:&lt;br /&gt;
&lt;br /&gt;
{{; interfaces}}&lt;br /&gt;
{{(definterface IFoo)}}&lt;br /&gt;
{{(definterface IBar)}}&lt;br /&gt;
&lt;br /&gt;
{{(deftype T [] IFoo)}}&lt;br /&gt;
{{(instance? IFoo (T.)) ; true}}&lt;br /&gt;
{{(instance? IBar (T.)) ; false}}&lt;br /&gt;
&lt;br /&gt;
{{; protocols}}&lt;br /&gt;
{{(defprotocol IFoo)}}&lt;br /&gt;
{{(defprotocol IBar)}}&lt;br /&gt;
&lt;br /&gt;
{{(deftype T [] IFoo)}}&lt;br /&gt;
{{(satisfies? IFoo (T.)) ; true}}&lt;br /&gt;
{{(satisfies? IBar (T.)) ; false}}&lt;br /&gt;
&lt;br /&gt;
However, the protocol version also works in ClojureScript.</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7257/replacing-marker-interfaces</guid>
<pubDate>Fri, 24 Jul 2015 04:07:32 +0000</pubDate>
</item>
<item>
<title>equality of non-unique lvars broken for clojure 1.7</title>
<link>https://ask.clojure.org/index.php/7249/equality-of-non-unique-lvars-broken-for-clojure-1-7</link>
<description>&lt;p&gt;clojure 1.7 changes the interning of strings when creating symbols, as is described here&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/master/changes.md#23-keyword-and-symbol-construction&quot;&gt;https://github.com/clojure/clojure/blob/master/changes.md#23-keyword-and-symbol-construction&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Therefore, two non-unique lvars with the same name don't have to be equal anymore with the current&lt;br&gt;
Lvar equality method which checks (identical? name (:name o)).&lt;/p&gt;
&lt;p&gt;This is causing expresso, which relies on non-unique lvars for the rule engine to fail with clojure 1.7&lt;/p&gt;
&lt;p&gt;changing the identical? to a = fixes the issue.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7249/equality-of-non-unique-lvars-broken-for-clojure-1-7</guid>
<pubDate>Thu, 25 Jun 2015 19:39:20 +0000</pubDate>
</item>
<item>
<title>Allow partial matching of keys not existing in a map</title>
<link>https://ask.clojure.org/index.php/7252/allow-partial-matching-of-keys-not-existing-in-a-map</link>
<description>When matching maps, it is sometimes useful to specify a map that doesn't include specific keys.&lt;br /&gt;
&lt;br /&gt;
Eg. to specify a map that doesn't include a :foo key:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(def _! :clojure.core.logic/not-found)&lt;br /&gt;
(run* [x]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(featurec x {:foo _!}))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The patch is minimal, and demonstrates the functionality.</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7252/allow-partial-matching-of-keys-not-existing-in-a-map</guid>
<pubDate>Wed, 20 May 2015 18:21:13 +0000</pubDate>
</item>
<item>
<title>walk* exponential in depth of tree terms?</title>
<link>https://ask.clojure.org/index.php/7260/walk-exponential-in-depth-of-tree-terms</link>
<description>&lt;p&gt;By 'reification' I mean e.g.:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(run 1 [t]
  (== t &amp;lt;some-constant-to-be-reified&amp;gt;))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Demonstration of exponential performance, using nested vectors ((link: ], [[]], [[[]])...):&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.refheap.com/1e30c198d528300fcba9ef24a&quot;&gt;https://www.refheap.com/1e30c198d528300fcba9ef24a&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Is this expected, or a bug? I'm guessing the former, but hoping the latter. Feel free to close without comment if this is just the way it is. :)&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7260/walk-exponential-in-depth-of-tree-terms</guid>
<pubDate>Wed, 28 Jan 2015 05:21:56 +0000</pubDate>
</item>
<item>
<title>Add non-interleaving version of conde</title>
<link>https://ask.clojure.org/index.php/7251/add-non-interleaving-version-of-conde</link>
<description>&lt;p&gt;For validation use cases having depth first search as an option would be very useful.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7251/add-non-interleaving-version-of-conde</guid>
<pubDate>Sun, 21 Dec 2014 20:13:57 +0000</pubDate>
</item>
<item>
<title>Guard against arity missmatches between rels, facts and retractions</title>
<link>https://ask.clojure.org/index.php/7272/guard-against-arity-missmatches-between-facts-retractions</link>
<description>&lt;p&gt;This patch adds arity checking to relations, facts and retractions so that if a user specifies that a rel &quot;foo&quot; shall be 3-tuple in the def-rel form it will be illegal to add a 4-tuple as a fact to the db. This protects the state of the DB against a class of user errors which would otherwise silently fail through.&lt;/p&gt;
&lt;p&gt;This is more a work proposal than anything, as it may well be legitimate to have a variable arity relation. I would just consider such a construct suspect, and this patch supports the way I've approached pldb.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7272/guard-against-arity-missmatches-between-facts-retractions</guid>
<pubDate>Thu, 11 Dec 2014 03:31:58 +0000</pubDate>
</item>
<item>
<title>FD logic doesn't always return all solutions</title>
<link>https://ask.clojure.org/index.php/7273/fd-logic-doesnt-always-return-all-solutions</link>
<description>Given the following code&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(run* [x11 x12 x13 &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x21 x22 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x24&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x31 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x33 x34&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x42 x43 x44]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fd/in x11 x12 x13 x21 x22 x24 x31 x33 x34 x42 x43 x44 (fd/interval 1 9))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fd/eq (= (+ x11 (/ x12 x13)) &amp;nbsp;&amp;nbsp;5)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (+ x21 (/ x22 &amp;nbsp;&amp;nbsp;2)) x24)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (+ x31 (/ &amp;nbsp;&amp;nbsp;6 x33)) x34)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (+ &amp;nbsp;&amp;nbsp;4 (/ x42 x43)) x44)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (+ x11 (/ x21 x31)) &amp;nbsp;&amp;nbsp;4)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (* x12 (/ x22 &amp;nbsp;&amp;nbsp;6)) x42)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (+ x13 (- &amp;nbsp;&amp;nbsp;2 x33)) x43)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(= (+ (- &amp;nbsp;5 x24) x34) &amp;nbsp;x44)))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have {{([1 4 1 3 6 6 1 1 7 4 2 6] [2 6 2 4 6 7 2 1 8 6 3 6])}} as a result. &lt;br /&gt;
&lt;br /&gt;
However, as soon as I change {{(fd/interval 1 9)}} to {{(fd/interval 0 9)}}, the result becomes an empty sequence. However, I expect it to include at least the two aforementioned solutions.</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7273/fd-logic-doesnt-always-return-all-solutions</guid>
<pubDate>Mon, 20 Oct 2014 19:18:16 +0000</pubDate>
</item>
<item>
<title>A warning is thrown regarding the redefinition of record? in clojure 1.6.0</title>
<link>https://ask.clojure.org/index.php/7266/warning-thrown-regarding-the-redefinition-record-clojure</link>
<description>&lt;p&gt;Clojure 1.6.0 adds a record? function that has the same implementation as the one in clojure.core.logic. As a result, a warning is shown when the code in the core.logic namespace is evaluated under clojure 1.6.0. Since the two functions have the same implementation, this is purely a cosmetic issue.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7266/warning-thrown-regarding-the-redefinition-record-clojure</guid>
<pubDate>Fri, 28 Mar 2014 03:27:45 +0000</pubDate>
</item>
<item>
<title>Finite Domains - Two consecutive calls to run* return different results</title>
<link>https://ask.clojure.org/index.php/7286/finite-domains-consecutive-calls-return-different-results</link>
<description>&lt;p&gt;Calling run*  twice with the same input may return different results for no apparent reason.&lt;br&gt;
See attachment.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7286/finite-domains-consecutive-calls-return-different-results</guid>
<pubDate>Sun, 23 Feb 2014 00:44:32 +0000</pubDate>
</item>
<item>
<title>walk* of an empty set overflows the stack</title>
<link>https://ask.clojure.org/index.php/7277/walk-of-an-empty-set-overflows-the-stack</link>
<description>&lt;p&gt;I noticed this issue when asserting a relation with an empty set in it in the new pldb stuff, the minimal case I have is (walk*  empty-s #{})&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7277/walk-of-an-empty-set-overflows-the-stack</guid>
<pubDate>Tue, 31 Dec 2013 10:07:13 +0000</pubDate>
</item>
<item>
<title>deftest test-34-unify-with-metadata appears incorrect</title>
<link>https://ask.clojure.org/index.php/7235/deftest-test-34-unify-with-metadata-appears-incorrect</link>
<description>&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(deftest test-34-unify-with-metadata&lt;br&gt;
  (is (run* [q]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        (== q (quote ^:haz-meta-daytuhs (form form form))))
  '((^:haz-meta-daytuhs (form form form)))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I am not sure what was intended for this, but replacing it with the following causes the test to fail.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(deftest test-34-unify-with-metadata&lt;br&gt;
  (is (= (run* [q]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;           (== q (quote ^:haz-meta-daytuhs (form form form))))
     '((^:haz-meta-daytuhs (form form form))))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I think the correct version is probably close to that, though.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7235/deftest-test-34-unify-with-metadata-appears-incorrect</guid>
<pubDate>Mon, 23 Dec 2013 07:10:25 +0000</pubDate>
</item>
<item>
<title>run macro should take * in addition to n</title>
<link>https://ask.clojure.org/index.php/7261/run-macro-should-take-in-addition-to-n</link>
<description></description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7261/run-macro-should-take-in-addition-to-n</guid>
<pubDate>Tue, 26 Nov 2013 23:28:57 +0000</pubDate>
</item>
<item>
<title>Extending cljs.core.logic with all of the functionality from clojure.core.logic</title>
<link>https://ask.clojure.org/index.php/7229/extending-cljs-core-logic-with-functionality-clojure-logic</link>
<description>&lt;p&gt;Repo I've been working from is here: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/aamedina/cljs.core.logic&quot;&gt;https://github.com/aamedina/cljs.core.logic&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've followed the code layout in clojure.core.logic pretty much verbatim, compensating for ClojureScript necessities, moved macros into sister .clj files. I have no hard opinions about the best way to organize the macros for each file, the way I do it is just the way I've found easiest, because then you don't have to namespace qualify every syntax quoted form that references a function in the sister .cljs file. &lt;/p&gt;
&lt;p&gt;Additionally I ported all of the clojure.core.logic tests with clojurescript.test.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7229/extending-cljs-core-logic-with-functionality-clojure-logic</guid>
<pubDate>Wed, 20 Nov 2013 03:05:40 +0000</pubDate>
</item>
<item>
<title>Unified map values are returned as LVar rather than the unified value in ClojureScript</title>
<link>https://ask.clojure.org/index.php/7244/unified-values-returned-rather-unified-value-clojurescript</link>
<description>This works correctly in core.logic for clojure:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(run 1 [q]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(fresh [v]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== v 1)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(== {:x v} q)))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In ClojureScript, I get this though:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
({:x &amp;lt;lvar:v_4&amp;gt;})&lt;br /&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7244/unified-values-returned-rather-unified-value-clojurescript</guid>
<pubDate>Sun, 29 Sep 2013 15:40:14 +0000</pubDate>
</item>
<item>
<title>dcg: def--&gt; ClassCastException</title>
<link>https://ask.clojure.org/index.php/7259/dcg-def-classcastexception</link>
<description>&lt;p&gt;I believe def--&amp;gt; needs to put its lsyms into a vector (as does --&amp;gt;). lsyms is passed to handle-clauses (as the env param), and there is used as a function. This causes an exception since a seq cannot be cast to a function.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7259/dcg-def-classcastexception</guid>
<pubDate>Fri, 23 Aug 2013 20:08:33 +0000</pubDate>
</item>
<item>
<title>compile time occurs check for pattern matching</title>
<link>https://ask.clojure.org/index.php/7255/compile-time-occurs-check-for-pattern-matching</link>
<description>&lt;p&gt;Claire Alvis correctly pointed out that it's easy to make a mistake when you have many clauses and accidentally use parameter name in a match for that parameter - we could easily do a compile time occurs check for these cases.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7255/compile-time-occurs-check-for-pattern-matching</guid>
<pubDate>Tue, 25 Jun 2013 23:32:39 +0000</pubDate>
</item>
<item>
<title>Allow tying multiple noms in one binder</title>
<link>https://ask.clojure.org/index.php/7242/allow-tying-multiple-noms-in-one-binder</link>
<description>I think it may be useful to be able to tie multiple noms in one binder, with or without significant order.&lt;br /&gt;
&lt;br /&gt;
A couple use cases I've thought of so far:&lt;br /&gt;
&lt;br /&gt;
Lambdas in a non-currying language. Here order matters.&lt;br /&gt;
&lt;br /&gt;
(== (list 'fn (ties [x y] (list '+ x y)))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(list 'fn (ties [z w] (list '+ z w)))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
My original use case, free/quantified variables in logical formulas. Order doesn't matter (note the second body has its noms swapped).&lt;br /&gt;
&lt;br /&gt;
(== (list '∀ (ties #{x y} (list '= (list '+ x y) (list '+ y x))))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(list '∀ (ties #{z w} (list '= (list '+ w z) (list '+ z w)))))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I have a draft implementation here: &lt;a href=&quot;https://github.com/tomjack/core.logic/compare/ties&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;https://github.com/tomjack/core.logic/compare/ties&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Possible issues with this implementation:&lt;br /&gt;
- Is it OK to reextend IWalkTerm to IPersistentSet?&lt;br /&gt;
- Should Tie and Ties present a uniform interface? (e.g. (tie? (ties #{x} x)))</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7242/allow-tying-multiple-noms-in-one-binder</guid>
<pubDate>Mon, 10 Jun 2013 21:29:53 +0000</pubDate>
</item>
<item>
<title>Make benchmark suite as easy to run as `lein test`</title>
<link>https://ask.clojure.org/index.php/7234/make-benchmark-suite-as-easy-to-run-as-lein-test</link>
<description>`lein benchmark` (or some other non-lein-based incantation) prints a report listing the name of each benchmark and its timing. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
$ lein benchmark&lt;br /&gt;
membero 2839&lt;br /&gt;
zebra 152738&lt;br /&gt;
$ lein benchmark comparison-report {:baseline &amp;quot;benchmark-5.9.2013-1&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:runs 5&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:diffs-only true&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:threshold 25} ; only consider different if the delta is &amp;gt; 25 ms. &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
membero +68ms&lt;br /&gt;
zebra -122ms&lt;br /&gt;
$ lein benchmark {:pretty true}&lt;br /&gt;
Thu May &amp;nbsp;9 11:21:41 PDT 2013&lt;br /&gt;
&lt;br /&gt;
Linux mars 2.6.32-5-amd64 #1 SMP Fri Feb 15 15:39:52 UTC 2013 x86_64 GNU/Linux&lt;br /&gt;
&lt;br /&gt;
java version &amp;quot;1.7.0_21&amp;quot;&lt;br /&gt;
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)&lt;br /&gt;
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)&lt;br /&gt;
&lt;br /&gt;
membero &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2839 ms&lt;br /&gt;
zebra &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;152738 ms&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I haven't looked for any Clojure benchmarking libs, but ideally this would be a trivial script that automates the repetitive manual task of running benchmark tests. Unlike the test suite, we aren't looking for binary success or failure. Every run will generate unique results, so the script should accommodate a fuzzier comparison. &lt;br /&gt;
&lt;br /&gt;
A &amp;quot;pretty&amp;quot; output that includes system info would be great for bug reports.</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7234/make-benchmark-suite-as-easy-to-run-as-lein-test</guid>
<pubDate>Thu, 09 May 2013 19:27:59 +0000</pubDate>
</item>
<item>
<title>Add label goal</title>
<link>https://ask.clojure.org/index.php/7248/add-label-goal</link>
<description>&lt;p&gt;This goal should enumerate any fd vars found in a fresh/ground var bound to a sequence. This would avoid some unintuitive behavior that came up on the mailing list:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(defne weighted-listo [l w]&lt;br&gt;
  ([() _] (fd/== w 0))&lt;br&gt;
  ([[h . t] _]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(fresh [n]
  (fd/in n (fd/interval 0 java.lang.Integer/MAX_VALUE))
  (fd/in h (fd/interval 1 java.lang.Integer/MAX_VALUE))
  (fd/+ h n w)
  (weighted-listo t n))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7248/add-label-goal</guid>
<pubDate>Mon, 29 Apr 2013 20:21:19 +0000</pubDate>
</item>
<item>
<title>StackOverFlowError when walking over set</title>
<link>https://ask.clojure.org/index.php/7278/stackoverflowerror-when-walking-over-set</link>
<description>&lt;p&gt;Walking a Clojure set seems to cause a StackOverFlowError:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run* [?s] (== ?s #{1 2 3}))&lt;/p&gt;
&lt;p&gt;(let [s #{1 2 3}] (run* [?s] (== ?s s)))&lt;/p&gt;
&lt;p&gt;(run* [?convertedseq ?seq] &lt;br&gt;
  (== ?seq #{1 2 3})&lt;br&gt;
  (project [?seq]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(== ?convertedseq (vector ?seq))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
StackOverflowError &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure.core.logic/walk*/fn--2722 (logic.clj:216)
clojure.core.logic/eval2927/fn--2928 (logic.clj:956)
clojure.core.logic.protocols/eval1478/fn--1479/G--1469--1486 (protocols.clj:55)
clojure.core.logic/walk* (logic.clj:214)
clojure.core.logic/walk*/fn--2722 (logic.clj:218)
clojure.core.logic/eval2927/fn--2928 (logic.clj:956)
clojure.core.logic.protocols/eval1478/fn--1479/G--1469--1486 (protocols.clj:55)
clojure.core.logic/walk* (logic.clj:214)
clojure.core.logic/walk*/fn--2722 (logic.clj:218)
clojure.core.logic/eval2927/fn--2928 (logic.clj:956)
clojure.core.logic.protocols/eval1478/fn--1479/G--1469--1486 (protocols.clj:55)
clojure.core.logic/walk* (logic.clj:214)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7278/stackoverflowerror-when-walking-over-set</guid>
<pubDate>Tue, 16 Apr 2013 22:55:33 +0000</pubDate>
</item>
<item>
<title>matcha/matchu are not faithful to the semantics of conda/condu</title>
<link>https://ask.clojure.org/index.php/7241/matcha-matchu-are-not-faithful-to-the-semantics-conda-condu</link>
<description>&lt;p&gt;The semantics of conda and condu give special importance to the head of each clause, but the pattern matching macros in core.logic that are built on top of them merge the body into the head. That means that every expression in a body position is considered when deciding which line is chosen, rather than just the expression in the head position. This is because the entire clause is wrapped in a fresh expression to bind the implicitly specified lvars that appear in the pattern.&lt;/p&gt;
&lt;p&gt;To illustrate:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
 (matcha ['a]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[['a] u#]
[['a] s#])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;;; expands to:&lt;/p&gt;
&lt;p&gt;(conda&lt;br&gt;
  [(fresh [] (== 'a 'a) u#)]&lt;br&gt;
  [(fresh [] (== 'a 'a) s#)])&lt;/p&gt;
&lt;p&gt;;; which has a different meaning than:&lt;/p&gt;
&lt;p&gt;(conda&lt;br&gt;
  [(== 'a 'a) u#]&lt;br&gt;
  [(== 'a 'a) s#])&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Ideally, we could devise a new system to marry the semantics of conda with pattern matching. At the very least, I think the offending macros should carry a warning in their docstring, stating this semantic difference.&lt;/p&gt;
&lt;p&gt;I suspect this would also cause the &quot;Third Commandment&quot; warning to apply to the entire line, rather than just the head/question, but I have not investigated that issue.&lt;/p&gt;
&lt;p&gt;Here's an example that demonstrates the difference in meaning:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
;; This does not succeed, because we commit to the first line, &lt;br&gt;
;; since the question succeeds, but then fail in the body.&lt;/p&gt;
&lt;p&gt;(run* [q]&lt;br&gt;
  (conda&lt;br&gt;
   [(== 'a 'a) u#]&lt;br&gt;
   [(== 'a 'a) s#]))&lt;/p&gt;
&lt;p&gt;;; =&amp;gt; ()&lt;/p&gt;
&lt;p&gt;;; This succeeds, because the whole line is used to determine which line to commit to, &lt;br&gt;
;; rather than just the pattern matching clause at the head. So when the first line fails,&lt;br&gt;
;; the second line is tried.&lt;/p&gt;
&lt;p&gt;(run* [q]&lt;br&gt;
  (matcha ['a]&lt;br&gt;
   [['a] u#]&lt;br&gt;
   [['a] s#]))&lt;/p&gt;
&lt;p&gt;;; =&amp;gt; (_0)&lt;br&gt;
&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7241/matcha-matchu-are-not-faithful-to-the-semantics-conda-condu</guid>
<pubDate>Thu, 04 Apr 2013 20:30:41 +0000</pubDate>
</item>
<item>
<title>add mod/rem/abs/min/max</title>
<link>https://ask.clojure.org/index.php/7256/add-mod-rem-abs-min-max</link>
<description>&lt;p&gt;SWI-Prolog's CLP(FD) module has this functionality &lt;a rel=&quot;nofollow&quot; href=&quot;http://www.swi-prolog.org/man/clpfd.html&quot;&gt;http://www.swi-prolog.org/man/clpfd.html&lt;/a&gt;&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7256/add-mod-rem-abs-min-max</guid>
<pubDate>Tue, 02 Apr 2013 18:48:16 +0000</pubDate>
</item>
<item>
<title>Allow unification with sequential in both directions</title>
<link>https://ask.clojure.org/index.php/7264/allow-unification-with-sequential-in-both-directions</link>
<description>&lt;p&gt;Currently I can't find a way to enable a custom data type to do unification with sequential objects in both direction. You can use IUnifyTerms to make it work in one direction, but it isn't possible to make it work in the other direction (i.e. when the sequential object is first).&lt;/p&gt;
&lt;p&gt;The problem seemes to be in the following code:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(defn unify-with-sequential* [u v s]&lt;br&gt;
  (cond&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(sequential? v)
(if (and (counted? u) (counted? v)
      (not= (count u) (count v)))
  nil
  (loop [u u v v s s]
    (if (seq u)
      (if (seq v)
        (if-let [s (unify s (first u) (first v))]
          (recur (next u) (next v) s)
          nil)
        nil)
      (if (seq v) nil s))))

(lcons? v) (unify-terms v u s)
:else nil))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If the final nil could be replaced with a call to a protocol (IUnifyTermsReversed ???IUnifyWithSequential ???) then I believe it would make this extensible.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7264/allow-unification-with-sequential-in-both-directions</guid>
<pubDate>Sun, 24 Mar 2013 03:10:33 +0000</pubDate>
</item>
<item>
<title>tie disequality</title>
<link>https://ask.clojure.org/index.php/7280/tie-disequality</link>
<description>&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(deftest test-tie-disequality&lt;br&gt;
  (is (= (run* [q]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       (nom/fresh [a b]
         (!= (nom/tie a a) 'hello)))
    '(_0)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;  (is (= (run* [q]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       (nom/fresh [a b]
         (!= (nom/tie a a) (nom/tie b b))))
    ())))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Currently, the first causes an error, because IPersistentMap (which gets called because Tie is a record!) assumes that the the other term is also a record (that seems like a bug). If we revert the commit which makes Tie a record, this works.&lt;/p&gt;
&lt;p&gt;The other one succeeds, when it should fail. This is regardless of whether Tie is a record or not.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7280/tie-disequality</guid>
<pubDate>Tue, 12 Mar 2013 11:37:39 +0000</pubDate>
</item>
<item>
<title>one-shot constraints with multiple rands may run more than once</title>
<link>https://ask.clojure.org/index.php/7283/one-shot-constraints-with-multiple-rands-may-more-than-once</link>
<description>&lt;p&gt;Here are two examples using fixc:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;br&gt;
(run* [q]&lt;br&gt;
  (fresh [x y]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(fixc [x y]
  (fn [[x y] a _] (!= x 1))
  (fn [[x y] a] (= (walk a x) (walk a y)))
  '...)
(== x y)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(run* [q]&lt;br&gt;
  (fresh [x y c d]&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(fixc [x y]
  (fn [[x y] a _] (!= x y))
  (fn [[x y] a] (or (not (lvar? (walk a x))) (not (lvar? (walk a y)))))
  '...)
(== [x y] [[c] [d]])))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The constraint != is reified twice in each example, showing that the fixc constraint indeed ran twice.&lt;/p&gt;
</description>
<category>core.logic</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/7283/one-shot-constraints-with-multiple-rands-may-more-than-once</guid>
<pubDate>Mon, 11 Mar 2013 21:10:21 +0000</pubDate>
</item>
</channel>
</rss>