Arc Forumnew | comments | leaders | submitlogin
1 point by absz 5973 days ago | link | parent

In that case, you want the zap macro:

  (zap join x '(a b c))
zap turns into, more or less,

  (= x (join x '(a b c)))
Its signature is (op place . args), so all the arguments are optimized.

However, we do need naming conventions; zap, though multipurpose, is still not completely general. And there are no good ones, unfortunately.



1 point by stefano 5972 days ago | link

The problem is that when using join with zap you need to cons a lot of memory, while a destructive join would not cons up memory, it would just traverse the list setting the right cdrs. Probably the expression "recycling operations" describes better what I wanted to say, because operations such as nconc reuse the memory of their arguments.

-----