;laat ik starten met de functionele stack (define (create-stack) (let ((stack (make-stack))) (define (push e) (set! stack (stack-push e stack))) (define (pop) (set! stack (stack-pop stack))) (define (empty?) (stack-empty? stack)) (define (dispatch mesg) (cond ((eq? mesg 'pop) pop) ((eq? mesg 'push) push) ((eq? mesg 'empty?) empty?) (else (error "aargl")))) dispatch)) ;en dan nu als de interface destructief is (define (create-stack) (let ((stack (make-stack))) (define (push e) (stack-push e stack)) (define (pop) (stack-pop stack)) (define (empty?) (stack-empty? stack)) (define (dispatch mesg) (cond ((eq? mesg 'pop) pop) ((eq? mesg 'push) push) ((eq? mesg 'empty?) empty?) (else (error "aargl")))) dispatch))