How do you copy an array in common lisp?

后端 未结 4 1445
温柔的废话
温柔的废话 2020-12-18 23:30

I\'d like to make copies of my 2D array, which feels like the nice, functional, nondestructive way of handling arrays. What is the lispy way of doing this?

4条回答
  •  自闭症患者
    2020-12-18 23:50

    If you want to do things the nice, functional, nondestructive way, then why do you even need to copy it?

    • if you're copying it in order to update it -- then you're not doing it the functional way.

    • if you're doing it the functional way -- then you don't need a copy. You can just pass it anywhere and everywhere.

    Maybe you want to transform it. In that case, you could use one of Lisp's many pure functions, such as mapcar or filter.

提交回复
热议问题