[LOGIC-74] Bug in conde (ClojureScript) Created: 26/Nov/12 Updated: 17/Mar/13 Resolved: 17/Mar/13 |
|
| Status: | Resolved |
| Project: | core.logic |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Kevin De Valck | Assignee: | David Nolen |
| Resolution: | Declined | Votes: | 0 |
| Labels: | bug | ||
| Environment: |
[org.clojure/clojure "1.4.0"] |
||
| Description |
|
While working on a project I found a somewhat strange behaviour. I reworked the problem in some simple predicate. Let's take this predicate foobad. (defn foobad
[?bar]
(l/project [?bar]
(l/fresh [?var]
(l/conde
[(l/== true (instance? js/Array ?bar))
(membero ?var (seq ?bar))]))))
When running (l/run* [?f] (foobad 0)) it produces this error:
Because 0 is not an instance of Array it should not be entering that conde clause where it tries (seq 0). With this workaround we get a normal behaviour: (defn foo
[?bar]
(l/project [?bar]
(l/fresh [?var]
(l/conde
[(l/== true (instance? js/Array ?bar))
(fresh [?s]
(l/== ?s (seq ?bar))
(membero ?var ?s))]))))
Running (l/run* [?f] (foo 0)) gives us (), which is what we expect. |
| Comments |
| Comment by David Nolen [ 28/Dec/12 12:49 AM ] |
|
I'm assuming this is referring the ClojureScript version of core.logic? |
| Comment by David Nolen [ 17/Mar/13 7:00 PM ] |
|
This is not a bug. Goals do not delay evaluation in this way. |