[comp.lang.lisp] scoops example: stacks

sherin@linc.cis.upenn.edu (Steve Sherin) (05/24/87)

;;; Stacks with Scoops--Steve Sherin

(define-class stack (instvars the-stack) (options inittable-variables
gettable-variables settable-variables))

(define-method (stack push) (value) (set! the-stack (cons value the-stack)))

(define-method (stack tos) () (if the-stack (car the-stack)))

(define-method (stack pop) () (if the-stack  
				(let ((top (tos)))
					(set! the-stack (cdr the-stack))
					top)))