I'm trying to do the exercise 2.12 of the book Essential of programing languages 3rd edition.
They ask me to do a procedural representation for a stack, like they did in the example of page 40 with enviroment.
This is the example.
(define empty-env
(lambda ()
(lambda (search-var)
(report-no-binding-found search-var))
)
)
(define extend-env
(lambda (saved-var saved-val saved-env)
(lambda (search-var)
(if (eqv? search-var saved-var)
saved-val
(apply-env saved-env search-var)
)
))
)
(define apply-env
(lambda (env search-var)
(env search-var))
)
In the exercise they ask me for the next procedures:
push, pop, top, and empty-stack?
I think I did the push, top and empty-stack. But I can't figure out how to do the pop.
Thank you.
pop, and (b) what you are not certain of.popis probably supposed to return a new stack without the top element, so why do you not simply return a new stack, but with doingreston the data? – Pål GD Jan 16 at 9:19