Fork me on GitHub

another question. are recursive anonymous goals possible in core.logic? i can’t get it working analogous to the regular fn.


this workaround seems to work:

(defn packo [l1 l2]
  (letfn [(transfero [a b c d]
            (matche [a b c d]
              ([x [] [] [x]])
              ([x [y . ys] [y . ys] [x]] (!= x y))
              ([x [x . xs] ys [x . zs]] (transfero x xs ys zs))))]
    (matche [l1 l2]
      ([[] []])
      ([[x . xs] [z . zs]]
       (fresh [ys]
         (transfero x xs ys z)
         (packo ys zs))))))


may be even more readable than fne etc on the other hand i think it should support naming the anonymous function and thus enable recursion, like the ordinary fn does. but maybe there is a reason why it doesn’t.