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

+3 votes
in Clojure by

Hi all: I'm wondering why these derive statements are not commutative?

(-> (make-hierarchy)
    (derive :b :c)
    (derive :a :b)
    (derive :a :c))
Execution error (Error) at (<cljs repl>:1).
:a already has :c as ancestor

(-> (make-hierarchy)
    (derive :a :c)
    (derive :b :c)
    (derive :a :b))
{:parents {:a #{:c :b}, :b #{:c}},
 :ancestors {:a #{:c :b}, :b #{:c}},
 :descendants {:c #{:b :a}, :b #{:a}}}

Each of the two lattices should be isomorphic, but one set of statements produces an ancestor error. What is the purpose of this error?

Thanks!

1 Answer

0 votes
ago by

I am falling into this trap as well.

There seems to be a reason for this check?

ago by
This probably should have been a comment on the original question—it isn't an answer to the question.
...