This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-04
Channels
- # beginners (56)
- # boot (11)
- # cider (1)
- # clojure (112)
- # clojure-denmark (4)
- # clojure-russia (7)
- # clojurescript (45)
- # component (1)
- # cursive (19)
- # data-science (10)
- # datacrypt (1)
- # datascript (22)
- # datomic (3)
- # defnpodcast (2)
- # emacs (4)
- # fulcro (26)
- # hoplon (21)
- # jobs-discuss (5)
- # klipse (5)
- # onyx (8)
- # portkey (1)
- # re-frame (8)
- # reagent (17)
- # ring (7)
- # shadow-cljs (14)
- # spacemacs (9)
- # vim (4)
given the rules:
[[(coords ?pos ?x ?y)
[?pos :position/x ?x]
[?pos :position/y ?y]]
[(near ?i1 ?i2)
[(inc ?i1) ?i2]]
[(near ?i1 ?i2)
[(dec ?i1) ?i2]]
[(neighbor ?pos1 ?pos2)
(coords ?pos1 ?x1 ?y1)
(near ?x1 ?x2)
(near ?y1 ?y2)
[?pos2 :position/x ?x2]
[?pos2 :position/y ?y2]]
[(connected ?pos1 ?pos2 ?via)
(neighbor ?pos1 ?via)
(neighbor ?pos2 ?via)]
I can’t get connected to return x and y’s that are in line with it to work correctly. eg. [2 2] should return [[4 4] [0 0]…] whereas [4 2] returns [[6 2] [2 0]…].
what am i doing wrong?i expect the first image to have [4 4] and [0 0] highlighted in green in addition to what is there, but the results i get are missing those 2 values.
a semi related question, does rule body order matter
[(rule1 ?a)
(subrule1 ?a)
(subrule2 ?a)]
[(rule2 ?a)
(subrule2 ?a)
(subrule1 ?a)]
should rule1 and rule2 be equivalent?I’m sorry i phrased my question weird, yes rule1 and rule2 are equal or yes rule order matters?
for function rules there’s just one limitation: all arguments should be bound at the call place
@tonsky https://github.com/tonsky/datascript/issues/239 and I didn’t mention it but thanks for responding