From 5141419efaf6d4d6184d284a768e4ced4584ebfd Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Fri, 8 Nov 2013 14:21:16 +0000 Subject: [PATCH] And once you know where the bug is, fixing it is easy. --- src/milkwood_clj/analyse.clj | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/milkwood_clj/analyse.clj b/src/milkwood_clj/analyse.clj index 37ec9fe..05f5bf5 100644 --- a/src/milkwood_clj/analyse.clj +++ b/src/milkwood_clj/analyse.clj @@ -23,15 +23,7 @@ rules: a rule tree (i.e. a recursively nested map token => rule-tree); path: a flat sequence of tokens." [rules path] - (cond - ;; if we have no more path, we're done. - (empty? path) nil - ;; if we have no more rules, compose a rule from what's left of the path - (empty? rules) (compose-rule path) - ;; replace in the rules the rule for the first of the path, with this new - ;; rule generated from the rest of the path and the old rule for the first - ;; of the path. - true (merge-rules rules (add-rule (rules (first path)) (rest path))))) + (merge-rules rules (compose-rule path))) (defn analyse-tokens "Read this sequence of tokens and process it into rules.