summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeikel Brandmeyer <mb@kotka.de>2009-06-23 23:20:22 +0200
committerRich Hickey <richhickey@gmail.com>2009-11-24 07:58:10 -0500
commit490e2f499ffdfaecc6e52805ded285f655b3020d (patch)
tree0ca2e2876dea1e66935eaa4bd828aac702d4eb49
parent284ee8aa7c81c4def1fd6808a4d80f5c0e5829e4 (diff)
zip/children now checks whether the node is a branch
Signed-off-by: Rich Hickey <richhickey@gmail.com>
-rw-r--r--src/clj/clojure/zip.clj4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/clj/clojure/zip.clj b/src/clj/clojure/zip.clj
index 00cc3be5..57b3b21b 100644
--- a/src/clj/clojure/zip.clj
+++ b/src/clj/clojure/zip.clj
@@ -66,7 +66,9 @@
(defn children
"Returns a seq of the children of node at loc, which must be a branch"
[loc]
- ((:zip/children ^loc) (node loc)))
+ (if (branch? loc)
+ ((:zip/children ^loc) (node loc))
+ (throw (Exception. "called children on a leaf node"))))
(defn make-node
"Returns a new branch node, given an existing node and new