有效地返回变异的结构

问题描述 投票:0回答:1

我有一个结构:

(defstruct spider omegas values continuation)

而且我有接受这种结构并返回其变异版本的函数:

(defun dec (s)
  (make-spider
    :omegas (spider-omegas s)
    :values (cons (- (car (spider-values s)) 1) (cdr (spider-values s)))
    :continuation (cdr (spider-continuation s))))

而且我有一种预感,这是在内存中创建不需要的新spider实例(Google一直没有帮助)。我关心我返回的是它自己的内存块,但是我不关心在完成函数时作为参数spiders。有没有更平滑的方法来返回这样的结构?

memory lisp structure common-lisp
1个回答
0
投票

如果只想改变参数结构对象:

© www.soinside.com 2019 - 2024. All rights reserved.