On Thursday, March 1, 2018 at 10:38:20 AM UTC-5, Jan Mercl wrote: > > On Thu, Mar 1, 2018 at 4:28 PM <[email protected] <javascript:>> wrote: > > > is the statement right? > > It depends on the POV. I see copy as more fundamental than append. It's > easy to write append using copy, not exactly trivial the other way around. > Consider cases like copy(a[], a[1:]) or copy(a[1:], a). > > >
copy(a, a[1:]) is equivalent to _ = append(a[:0], a[1:]...), and copy(a[1:], a) is equivalent to _ = append(s[1:1], s[:len(s)-1]...) Yes, all append uses can also be simulated by make+copy. > -- > > -j > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
