Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fronx/1313864 to your computer and use it in GitHub Desktop.
Save fronx/1313864 to your computer and use it in GitHub Desktop.
;; fronx's solution to Transitive Closure
;; https://4clojure.com/problem/84
(fn [rel]
(let [trans (set
(for [[a b] rel [c d] rel]
[a (if (= b c) d b)]))
done (= trans rel)]
(if done trans (recur trans))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment