diff options
author | Meikel Brandmeyer <mb@kotka.de> | 2009-06-23 23:20:22 +0200 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2009-11-24 07:58:10 -0500 |
commit | 490e2f499ffdfaecc6e52805ded285f655b3020d (patch) | |
tree | 0ca2e2876dea1e66935eaa4bd828aac702d4eb49 | |
parent | 284ee8aa7c81c4def1fd6808a4d80f5c0e5829e4 (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.clj | 4 |
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 |