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

+2 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!

Please log in or register to answer this question.

...