RosettaCodeData/Task/Stack/CoffeeScript/stack-2.coffee

17 lines
326 B
CoffeeScript
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
(defstruct stack
elements)
(defun stack-push (element stack)
(push element (stack-elements stack)))
(defun stack-pop (stack)(deftype Stack [elements])
(defun stack-empty (stack)
(endp (stack-elements stack)))
(defun stack-top (stack)
(first (stack-elements stack)))
(defun stack-peek (stack)
(stack-top stack))