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

should vector pattern match any AbstractVector? #36

Open
simeonschaub opened this issue Dec 14, 2024 · 0 comments
Open

should vector pattern match any AbstractVector? #36

simeonschaub opened this issue Dec 14, 2024 · 0 comments

Comments

@simeonschaub
Copy link

I expected this to return 2 instead of nothing:

julia> using Moshi.Match: @match

julia> @match view([1, 2, 3], :) begin
           [1, x, 3] => x
           _ => nothing
       end

The culprit seems to be that [1, x, 3] looks for v isa Vector instead of v isa AbstractVector. Would this make sense to generalize to AbstractVector?

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

1 participant