<!-- 
RSS generated by JIRA (4.4#649-r158309) at Sun May 19 11:03:34 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/LOGIC-51/LOGIC-51.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[LOGIC-51] fd comparison relations behave strange when used with literals</title>
                <link>http://dev.clojure.org/jira/browse/LOGIC-51</link>
                <project id="10020" key="LOGIC">core.logic</project>
                        <description>&lt;p&gt;The fd comparison relations always succeed when used with strings or a string and an integer:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (run* [q]
 (&amp;lt;=fd &quot;foo&quot; &quot;bar&quot;))
(_.0)
user&amp;gt; (run* [q]
 (&amp;lt;=fd &quot;foo&quot; 1))
(_.0)
user&amp;gt; (run* [q]
 (&amp;lt;=fd 1 &quot;bar&quot;))
(_.0)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;IMHO, they should always fail if one argument is not a integer.&lt;/p&gt;

&lt;p&gt;Furthermore, you get an exception when comparing integers and the larger integer is given first.&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (run* [q]
 (&amp;lt;=fd 1 2))
(_.0)  ;; That&apos;s correct, but...
user&amp;gt; (run* [q]
 (&amp;lt;=fd 2 1))
IllegalArgumentException No implementation of method: :member? of protocol: #&apos;clojure.core.logic/ISet found for class: nil  clojure.core/-cache-protocol-fn (core_deftype.clj:533)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;d expect that comparisons of two integers should always work.  You can circumvent this issue by unifying the numbers with some logic variables first, but is that really needed?&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (run* [q]
 (fresh [a b]
  (== a 1)
  (== b 2)
  (&amp;lt;=fd a b)))
(_.0)
user&amp;gt; (run* [q]
 (fresh [a b]
  (== a 1)
  (== b 2)
  (&amp;lt;=fd b a)))
()
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first issue cannot be circumvented using this approach, though.&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (run* [q]
 (fresh [a b]
  (== a &quot;foo&quot;)
  (== b 2)
  (&amp;lt;=fd b a)))
(_.0)
user&amp;gt; (run* [q]
 (fresh [a b]
  (== a &quot;foo&quot;)
  (== b 2)
  (&amp;lt;=fd a b)))
(_.0)
user&amp;gt; (run* [q]
 (fresh [a b]
  (== a &quot;foo&quot;)
  (== b &quot;bar&quot;)
  (&amp;lt;=fd a b)))
(_.0)
user&amp;gt; (run* [q]
 (fresh [a b]
  (== a &quot;foo&quot;)
  (== b &quot;bar&quot;)
  (&amp;lt;=fd b a)))
(_.0)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>java version &amp;quot;1.7.0_07&amp;quot;&lt;br/&gt;
OpenJDK Runtime Environment (IcedTea7 2.3.2) (Gentoo build 1.7.0_07-b30)&lt;br/&gt;
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)&lt;br/&gt;
&lt;br/&gt;
org.clojure/clojure &amp;quot;1.5.0-alpha4&amp;quot;&lt;br/&gt;
org.clojure/core.logic &amp;quot;0.8-alpha3&amp;quot;</environment>
            <key id="15681">LOGIC-51</key>
            <summary>fd comparison relations behave strange when used with literals</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="5" iconUrl="http://dev.clojure.org/jira/images/icons/status_resolved.gif">Resolved</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="dnolen">David Nolen</assignee>
                                <reporter username="tsdh">Tassilo Horn</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Sep 2012 04:46:23 -0500</created>
                <updated>Fri, 26 Oct 2012 07:04:24 -0500</updated>
                    <resolved>Fri, 26 Oct 2012 07:04:24 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="29399" author="dnolen" created="Fri, 7 Sep 2012 11:14:00 -0500"  >&lt;p&gt;Thanks for the report will look into it.&lt;/p&gt;</comment>
                    <comment id="29808" author="dnolen" created="Fri, 26 Oct 2012 01:06:19 -0500"  >&lt;p&gt;I see no particular need to validate inputs. The other issues should be resolved in one of the latest betas.&lt;/p&gt;</comment>
                    <comment id="29810" author="tsdh" created="Fri, 26 Oct 2012 02:01:50 -0500"  >&lt;p&gt;&amp;gt; I see no particular need to validate inputs.&lt;/p&gt;

&lt;p&gt;Well, the reported behavior (&quot;every non-integer is both smaller and greater than anything&quot;) is likely to hide bugs in queries.  But hey, even if you don&apos;t see a particular need, something you did fixed that problem anyhow. &lt;img class=&quot;emoticon&quot; src=&quot;http://dev.clojure.org/jira/images/icons/emoticons/wink.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;This is with 0.8.0-beta1:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;user&amp;gt; (run* [q] (&amp;lt;=fd 23 &quot;1&quot;))
IllegalArgumentException No implementation of method: :ub of protocol: #&apos;clojure.core.logic/IInterval found for class: java.lang.String  clojure.core/-cache-protocol-fn (core_deftype.clj:562)
user&amp;gt; (run* [q] (&amp;lt;=fd &quot;1&quot; 23))
IllegalArgumentException No implementation of method: :lb of protocol: #&apos;clojure.core.logic/IInterval found for class: java.lang.String  clojure.core/-cache-protocol-fn (core_deftype.clj:562)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;IMO, both an exception and simply failing would be ok in those situations.  Exception like now is probably even better.&lt;/p&gt;

&lt;p&gt;&amp;gt; The other issues should be resolved in one of the latest betas.&lt;/p&gt;

&lt;p&gt;Yes, it is.  Thanks a lot, David! Feel free to close this issue.&lt;/p&gt;</comment>
                    <comment id="29811" author="dnolen" created="Fri, 26 Oct 2012 07:04:24 -0500"  >&lt;p&gt;Thanks for the update!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                                                                                            </customfields>
    </item>
</channel>
</rss>