Open xushiwei opened 3 years ago
It's awkward that there is a slice syntax a[start:end:cap]
in Go.
However, if a is not a slice or array type, we still can use a[start:end:step]
.
Or usestart:end by step
?
a[start:end by step] = value
for i <- start:end by step {
...
}
for i := range start:end by step {
...
}
julia & matlab:
start:step:end
type Matrix[T Numeric] struct ...
func (m *Matrix[T]) [] (i, j int) T { // getter: x = m[i, j] translates to x = m.[](i, j)
}
func (m *Matrix[T]) []= (i, j int, x T) { // setter: m[i, j] = x translates to m.[]=(i, j, x)
}
From https://medium.com/@rhadar/a-data-scientists-take-on-go-ed408c00ac45, https://github.com/golang/go/issues/41129
Only implement for range in milestone v1.1