Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does BitBasis support efficient slicing? #53

Closed
hz-xiaxz opened this issue Jun 25, 2024 · 1 comment
Closed

Does BitBasis support efficient slicing? #53

hz-xiaxz opened this issue Jun 25, 2024 · 1 comment

Comments

@hz-xiaxz
Copy link
Contributor

hz-xiaxz commented Jun 25, 2024

I hope to slice the LongBitStr like the intrinsic String type in Julia. For example, for Julia Strings it works like

julia> a = "abab"
"abab"

julia> a[1:2]
"ab"

where a[1:2] return the same String-typed result.

However for BitBasis 0.9.3 it returns a certain Vector type

julia> b = bit"0101"
0101 ₍₂₎

julia> b[1:2]
2-element Vector{Int64}:
 1
 0

julia> BitStr(b[1:2])
01 ₍₂₎

which needs an extra operation to convert it back to BitStr type, consuming computation time.
Is it possible to overload the slicing operation or provide a SubString function like discussed in StackOverflow?

@GiggleLiu
Copy link
Member

Resolved in #54 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants