[GAP Forum] Removing zeros from a list

Arkadiusz Bochniak arkadiusz.bochniak at doctoral.uj.edu.pl
Thu May 6 20:05:50 BST 2021


Hi,

I would like to remove all zeros from a given list.



Suppose I have a list s, e.g. s:=[3,4,0,9];;. I tried to use RemoveSet(s,0); s; but I got the following error:

Error, RemoveSet: <set> must be a mutable proper set
(not a non-strictly-sorted plain list

The same problem appeared when I tried to remove 9. On the other hand, when the list does not contain zeros there is no such a problem (e.g. it works perfectly for s := [3,4,5,9];; and RemoveSet(s,9); s;). What is the reason for that? How to fix it in order to be able to remove zeros from a given list?

Best,
Arkadiusz


More information about the Forum mailing list