diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-07-28 01:38:12 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-07-28 01:38:12 +0000 |
commit | 7852231d4cf15d8ceb7c0ba46a909e57e3f1a89a (patch) | |
tree | f5fa0511cd28122e4b076bb338c86e3177dd586c /src | |
parent | 544ef19f0bc998515d51ca26ae2fd49cec5c1842 (diff) |
removed nil returns from derive/underive base cases
Diffstat (limited to 'src')
-rw-r--r-- | src/clojure/boot.clj | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/clojure/boot.clj b/src/clojure/boot.clj index a4725135..7b515309 100644 --- a/src/clojure/boot.clj +++ b/src/clojure/boot.clj @@ -2833,15 +2833,16 @@ not-every? (comp not every?)) (assoc ret k (reduce conj (get targets k #{}) (cons target (targets target))))) m (cons source (sources source))))] - (when-not (contains? (tp tag) parent) - (when (contains? (ta tag) parent) - (throw (Exception. (print-str tag "already has" parent "as ancestor")))) - (when (contains? (ta parent) tag) - (throw (Exception. (print-str "Cyclic derivation:" parent "has" tag "as ancestor")))) - - {:parents (assoc (:parents h) tag (conj (get tp tag #{}) parent)) - :ancestors (tf (:ancestors h) tag td parent ta) - :descendants (tf (:descendants h) parent ta tag td)})))) + (or + (when-not (contains? (tp tag) parent) + (when (contains? (ta tag) parent) + (throw (Exception. (print-str tag "already has" parent "as ancestor")))) + (when (contains? (ta parent) tag) + (throw (Exception. (print-str "Cyclic derivation:" parent "has" tag "as ancestor")))) + {:parents (assoc (:parents h) tag (conj (get tp tag #{}) parent)) + :ancestors (tf (:ancestors h) tag td parent ta) + :descendants (tf (:descendants h) parent ta tag td)}) + h)))) (defn underive "Removes a parent/child relationship between parent and @@ -2858,7 +2859,8 @@ not-every? (comp not every?)) (assoc ret k (reduce disj (get targets k) (cons target (targets target))))) m (cons source (sources source))))] - (when (contains? (tp tag) parent) + (if (contains? (tp tag) parent) {:parent (assoc (:parents h) tag (disj (get tp tag) parent)) :ancestors (tf (:ancestors h) tag td parent ta) - :descendants (tf (:descendants h) parent ta tag td)})))) + :descendants (tf (:descendants h) parent ta tag td)} + h)))) |