Thank you, Konstantin. I really appreciate your response, I didn't read those links before you sent them to me, but I read them yesterday, now everything is so clear to me, and I know what is going on with "slice," "append," and "copy" in memory. I was so confused, but now I know what's going on. On Friday, August 6, 2021 at 9:30:35 PM UTC+4:30 Konstantin Khomoutov wrote:
> On Fri, Aug 06, 2021 at 12:42:34AM -0700, Miraddo wrote: > > Hi! > > > I can not understand why when we use append, it does not rewrite values > in > > the same address in the memory that it had before, > > > > (I'm not sure it "append" problem or the variable | or just my problem > for > > sure :) ) > [...] > > I saw all addresses in memory was changed, > > > > now my question is why it doesn't rewrite the values in the same address > as > > before? > [...] > > Have you read and understood [1] and [2]? > I think the information from these articles will enable you to solve your > problem all by yourself. > > I would also argue that rotating an array *in place* by a non-negative > value > is "classically" solved by using a temporary variable and moving of the > array elements; the latter can be done by using copy(). > > 1. https://blog.golang.org/slices-intro > 2. https://blog.golang.org/slices > > -- 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/d37f5288-ce22-4b96-b172-12fafb250148n%40googlegroups.com.