Reputation: 1753
I am learning Elisp by reading others' code. Then I found people use both delete
and remove
to delete element from sequence. I checked the document and the code of remove
it seams just a wrapper for delete
which when the sequence is a list, do a copy-sequence
.
Is it really matter to copy list to do the delete
? Or I can just use delete
which is a C
command which should be more efficient I think.
Upvotes: 1
Views: 528
Reputation: 7727
remove
returns
a copy of seq with all occurrences of elt removed.
whereas delete
delete[s] by side effect any occurrences of elt as a member of seq.
so it modifies the original sequence. (Unless the first element is a hit, so pleasee consult C-hf delete for full details.)
Upvotes: 4