Skip to content

Commit

Permalink
refined countvalues aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
chakravala committed Oct 2, 2024
1 parent 7ab7f91 commit f567881
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "StaticVectors"
uuid = "20fadf95-9e3d-483c-97cd-cab2760e7998"
authors = ["Michael Reed"]
version = "1.0.5"
version = "1.0.6"

[deps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
25 changes: 25 additions & 0 deletions src/StaticVectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,32 @@ const SVector,MVector,SizedVector = Values,Variables,FixedVector

end

"""
count(a::Int,b::Int) -> Values
Generates an incremental `Int` list of `Values` from `a` to `b`.
"""
@pure Base.count(a::Int,b::Int) = countvalues(a,b)

"""
countvalues(a::Int,b::Int) -> Values
Generates an incremental `Int` list of `Values` from `a` to `b`.
"""
@pure countvalues(a::Int,b::Int) = Values{max(0,b-a+1),Int}(a:b...)

"""
evenvalues(a::Int,b::Int) -> Values
Generates an `Int` list of `Values` by skipping in twos from `a` to `b`.
"""
@pure evenvalues(a::Int,b::Int) = Values{((b-a)÷2)+1,Int}(a:2:b...)

"""
evens(a::Int,b::Int) -> Values
Generates an `Int` list of `Values` by skipping in twos from `a` to `b`.
"""
const evens = evenvalues

end # module

2 comments on commit f567881

@chakravala
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/116439

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.6 -m "<description of version>" f567881d6526d89d56d367ab6000df7c043ddaac
git push origin v1.0.6

Please sign in to comment.