I think there is definitely a need for a built-in "*remove*" function for arrays and slice. Everyone is writing their own implementation for this, it is both confusing and "x = append(a[:x], b[x:])" like blablabla is not readable.
5 Şubat 2021 Cuma tarihinde saat 02:55:36 UTC+3 itibarıyla selahad...@gmail.com şunları yazdı: > Hi, > I wonder if there are any proposals for the Remove method for Slices, > which removes an element from a Slice. > > Since the status of the latest generics draft is `likely accepted` and > it'd be possible to implement this with `generics`. I believe such an > addition to language would alleviate the need to `loop + swap + resize` > each time, and enhance the overall readability since there is a consensus. > > This may seem trivial, but I want to highlight some examples from other > langs just to further* concretize*: > arraylist.remove(object o) => java > list.remove(val) => python > array.remove(at: 0) => swift > > I have looked for the proposals for Go 2 but couldn't find any regarding > this issue. > > There are obviously more things to consider, like whether the operation > should keep the order. > > I'd be very happy with your responses to this pseudo-proposal. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/5bb8c897-bc14-4688-810e-c3b403216e72n%40googlegroups.com.