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
Yes, I think some way of doing this should be provided.
Unless we can find an easy shortcut, the roadmap in my head is:
Add a static unit range type, which is returned from e.g. indices(::SVector). This would be a dataless "singleton"
Maybe add another static step range type. With a pure constructor we can have SStepRange(2,2,N-1) deal with type parameters at run-time. The biggest problem here is actually the N-1...
Define conversions from these to SVector
Make the macro do this / define a new @SA macro that does multiple things.
For now, I would define an extra pure function this way:
Base.@purefunctionmyrange(N::Int)
r =2:2:N-1SVector((r...))
end
a[myrange(N)]
The
@SVector
macro currently supports functions likerand
,fill
and so on. Is it possible to supportStepRange
s? For example, couldwhere
N
is a type parameter, be allowed?One use case would be convenient slicing of
SArray
s, as discussed here, without the need for writing a custom function for each different slice.This request might be a special case of the comprehension syntax, which cannot currently make use of type parameters.
The text was updated successfully, but these errors were encountered: