Add stack-size
Adds a function that returns the size of the specified stack in a given state.
This commit is contained in:
parent
db085080b3
commit
89f0f3568a
@ -35,6 +35,11 @@
|
|||||||
[state stack]
|
[state stack]
|
||||||
(empty? (get state stack)))
|
(empty? (get state stack)))
|
||||||
|
|
||||||
|
;; Returns the stack size
|
||||||
|
(defn stack-size
|
||||||
|
[state stack]
|
||||||
|
(count (get state stack)))
|
||||||
|
|
||||||
;; Returns the top item on the stack
|
;; Returns the top item on the stack
|
||||||
(defn peek-stack
|
(defn peek-stack
|
||||||
[state stack]
|
[state stack]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user