From 490e2f499ffdfaecc6e52805ded285f655b3020d Mon Sep 17 00:00:00 2001 From: Meikel Brandmeyer Date: Tue, 23 Jun 2009 23:20:22 +0200 Subject: zip/children now checks whether the node is a branch Signed-off-by: Rich Hickey --- src/clj/clojure/zip.clj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2