Skip to content

Instantly share code, notes, and snippets.

@jebberjeb
Created November 3, 2013 03:31
Show Gist options
  • Save jebberjeb/7286347 to your computer and use it in GitHub Desktop.
Save jebberjeb/7286347 to your computer and use it in GitHub Desktop.
(ns test-app.core)
(def h (atom (make-hierarchy)))
(swap! h derive ::square ::shape)
(swap! h derive ::red-square ::square)
(def one (isa? @h ::red-square ::shape)) ;; => true
(swap! h underive ::red-square ::shape)
(def two (isa? @h ::red-square ::shape)) ;; => true (shape isn't parent of red-squares)
(swap! h underive ::red-square ::square)
(def three (isa? @h ::red-square ::shape)) ;; => false
[one two three]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment