Hi Paulo! Sorry for the delay.
As far as path compression, you might check out section 3.2 in this unpublished paper: https://www.cs.indiana.edu/~lkuper/papers/walk.pdf Have you tried benchmarking your code? Cheers, --Will On Thu, Feb 2, 2017 at 6:39 PM, Paulo César Cuneo < [email protected]> wrote: > Hi minikanren list! > > I was implementing my own version of minikanren in clojure and i figure > out i could interleave walk with unifiy, so i could flatten out lvars chain. > Beside the current version isnt tail recursive (and may stackoveflow), see > any problem. > I guess cache may missbehave, but lvars are not compacted together, soo i > dont know. > Is there a minikanren benchmark test anywhere? > Someone already tried this? > > > (defn unify [x y a] > (cond > (lvar? x) (let [x' (get-var a x) > ;; get-var is not walk > a' (if (lvar? x') > (if (= x x') > (ext-s a x' y) > (unify x' y a)) > (unify y x' a)) > x'' (get-var a' x')] > ;; compress path > (ext-s a' x x'')) > (or (seq? x) > (seq? y)) (unify-seq x y a) > (= x y) a > :else nil)) > > Bye. > > -- > You received this message because you are subscribed to the Google Groups > "minikanren" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/minikanren. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "minikanren" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/minikanren. For more options, visit https://groups.google.com/d/optout.
