假设我有一些返回结构的函数:
(struct layer (points lines areas))
(define (build-new-layer height)
...
(layer list-a list-b list-c))
我想跟踪最后返回的结果,例如:
(define top-side (build-new-layer 0)) ; store the first result
...
(set! top-side (build-new-layer 0.5)) ; throw away the first result and store the new one
但是,对于该特定代码,我收到错误:
set!: assignment disallowed;
cannot modify a constant
constant: top-side
请告诉我什么是做我想做的事情的正确方法