[GAP Forum] Removing zeros from a list

Benjamin Sambale benjamin.sambale at gmail.com
Thu May 6 20:28:55 BST 2021


You may use Filtered(s,x->x<>0);

Best wishes,
Benjamin

Am 06.05.21 um 21:05 schrieb Arkadiusz Bochniak:
> 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
> _______________________________________________
> Forum mailing list
> Forum at gap-system.org
> https://mail.gap-system.org/mailman/listinfo/forum




More information about the Forum mailing list