This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-02
Channels
- # admin-announcements (1)
- # aws-lambda (9)
- # beginners (161)
- # boot (1)
- # cider (3)
- # cljsrn (36)
- # clojure (245)
- # clojure-austin (2)
- # clojure-denmark (3)
- # clojure-dev (11)
- # clojure-greece (6)
- # clojure-italy (25)
- # clojure-russia (5)
- # clojure-serbia (1)
- # clojure-spec (76)
- # clojure-uk (78)
- # clojurescript (168)
- # clojurex (4)
- # community-development (7)
- # core-async (11)
- # core-logic (5)
- # css (6)
- # cursive (8)
- # data-science (6)
- # datomic (5)
- # devops (4)
- # duct (17)
- # emacs (1)
- # figwheel (8)
- # fulcro (51)
- # hoplon (4)
- # instaparse (3)
- # kekkonen (6)
- # klipse (3)
- # lein-figwheel (9)
- # luminus (2)
- # lumo (3)
- # midje (4)
- # off-topic (11)
- # om (4)
- # onyx (62)
- # other-languages (60)
- # re-frame (21)
- # reagent (63)
- # rum (1)
- # shadow-cljs (22)
- # spacemacs (22)
- # specter (23)
- # test-check (2)
- # vim (2)
- # yada (6)
thank you @norman, i've found a way to obtain the correct solution, see this ticket if interested https://dev.clojure.org/jira/browse/LOGIC-185
I'm going thru the reasoned schemer and i've noticed that the order of excecution differ sometimes in core.logic. in particular 'conde' seems to behave differently, looks like it tries all branch before doing any recursion. Any toughts on this?
(defn pairo [x]
(fresh [y] (firsto x y)))
(defn unwrapo [x y]
(conde
[(pairo x) (fresh [a] (firsto x a) (unwrapo a y))]
[(== x y)]))
(run* [q] (unwrapo '(((pizza))) q))
; ((((pizza)))
; ((pizza))
; (pizza)
; pizza
; )
;while in TRS it returns
; (pizza
; (pizza)
; ((pizza))
; (((pizza)))
; )
;both:
(run 1 [q] (unwrapo q 'pizza))
;and
(run 1 [q] (unwrapo (list (list q)) 'pizza))
;returns:
;=> (pizza)
;while in TRS it returns
;=> ()