Created
February 26, 2014 18:53
-
-
Save mgadzhi/9235956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns algo.stack) | |
(defn make-stack [] {:first nil}) | |
(defn is-empty? [stack] (nil? (:first stack))) | |
(defn stack-push [stack item] | |
(let [previous (:first stack)] | |
{:first | |
{:item item :next previous}})) | |
(defn stack-pop [stack] | |
(:next (:first stack))) | |
(defn stack-popped [stack] | |
(:item (:first stack))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment