Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.logic by

`
(ns test
(:refer-clojure :exclude [==])
(:require
[clojure.core.logic :refer :all]))

(defn foo [in out]
(matcha
[in out]
([('and a b . ()) ('and x y . ())] (foo a x) (foo b y))
([a ('bar ('baz a . ()) . ())])))

;; I get a stack overflow with the following, but if I remove one conjunct, then it will run.

(run 1 [q] (foo

        '(and p
              (and p
                   (and p
                        (and p
                             (and p
                                  (and p
                                       (and p
                                            (and p
                                                 (and p
                                                      (and p
                                                           (and p p)))))))))))
        q))

`

6 Answers

0 votes
by

Comment made by: dnolen

It looks this issue still exists even if you swap the matcha with matche

0 votes
by

Comment made by: austinhaas

I think the overflow is occurring during reification.

I was getting this error when returning a result from run, but now that I'm using the same value as the input to another goal there is no overflow.

If you replace q in the foo call with a fresh variable, it will not overflow.

0 votes
by

Comment made by: dnolen

This works for me on master. Can you give me more specifics about your setup so I can try to recreate? I'm on OS X 10.8 running JDK 7 64bit.

0 votes
by

Comment made by: austinhaas

I don't see the issue anymore, but I believe I was using Java 1.6 when I reported it and now I am using:

$ java -version
java version "1.7.0_15"
Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

0 votes
by

Comment made by: dnolen

OK, thanks for the quick response, I'll double check how things look under 1.6.

0 votes
by
Reference: https://clojure.atlassian.net/browse/LOGIC-114 (reported by austinhaas)
...