Replace an item in a list in Common Lisp?

前端 未结 10 1727
春和景丽
春和景丽 2021-02-02 10:12

I have a list of things (I\'ll call it L), an index(N) and a new thing(NEW). If I want to replace the thing in L at N with NEW, what is the best way to do this? Should I get the

10条回答
  •  无人及你
    2021-02-02 10:32

    Use [REPLACE][1] (I use X instead of your T as T is the true value in Lisp):

    (replace L (list X) :start1 N)
    

    [1]: http://www.lispworks.com/documentation/HyperSpec/Body/f_replac.htm REPLACE

提交回复
热议问题