You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I encountered a case where I wanted to take the first n elements from a slice.
With the slice[low:high] notation you have to first check, whether the slice has n elements, which makes this simple operation rather long.
thingsToTake := 7
if len(things) > thingsToTake {
things = things[0:thingsToTake]
}
Do you think, such a feature would be appropriate for gen?
The text was updated successfully, but these errors were encountered:
It’s certainly a convenient method, I use it in LINQ a lot. Will think about it – on the one hand, it’s handy. On the other, it’s very nearly covered by normal slice operations, so it feels like sugar.
Today I encountered a case where I wanted to take the first n elements from a slice.
With the slice[low:high] notation you have to first check, whether the slice has n elements, which makes this simple operation rather long.
Do you think, such a feature would be appropriate for
gen
?The text was updated successfully, but these errors were encountered: