Re: [go-nuts] Re: converting slice of items into nested array

2016-12-08 Thread Marvin Renich
* Mikael Gustavsson [161208 03:55]: > There's no need to use maps, you want to follow this pattern: > > for i := range items { > if i==0 || !grouped(i-1, i) { > appendToResult > } > appendToGroup > } > > Here's the full example: https://play.golang.org/p/1e0rDDmq7b

[go-nuts] Re: converting slice of items into nested array

2016-12-08 Thread Mikael Gustavsson
There's no need to use maps, you want to follow this pattern: for i := range items { if i==0 || !grouped(i-1, i) { appendToResult } appendToGroup } Here's the full example: https://play.golang.org/p/1e0rDDmq7b -- You received this message because you are subscribed to the Google