From 89f0f3568ab960d48ec15ba230ddf0be242b6d96 Mon Sep 17 00:00:00 2001 From: Nic McPhee Date: Tue, 10 Nov 2020 16:14:23 -0600 Subject: [PATCH] Add `stack-size` Adds a function that returns the size of the specified stack in a given state. --- src/propeller/push/state.cljc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/propeller/push/state.cljc b/src/propeller/push/state.cljc index 5026dec..f6c0490 100755 --- a/src/propeller/push/state.cljc +++ b/src/propeller/push/state.cljc @@ -35,6 +35,11 @@ [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 (defn peek-stack [state stack]