Skip to content

Commit

Permalink
Add a function that detects nested vector depth
Browse files Browse the repository at this point in the history
  • Loading branch information
swlkr committed Mar 19, 2019
1 parent a1df0eb commit b5582e1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/coast/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,12 @@
(with-meta (symbol name)
(meta value))
value))


(defn depth
([val]
(depth val 0))
([val idx]
(if (sequential? val)
(depth (first val) (inc idx))
idx)))

0 comments on commit b5582e1

Please sign in to comment.