We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
let
@match 1 begin let x = 1 end => x end
is the only example, which doesn't show why I would want to use it.
The text was updated successfully, but these errors were encountered:
Creating (local) bindings during matching is a function that cannot be expressed by other syntax.
In terms of the real-world use case, sometimes you might want to use one body for multiple cases, then some cases need to create default values:
f(expr) = @match expr begin :($f($(args...); $(kwargs...))) || :($f($(args...))) && let kwargs = [] end => (f, args, kwargs) end julia> f(:(func(a, b; c= 1))) (:func, Any[:a, :b], Any[:($(Expr(:kw, :c, 1)))]) julia> f(:(1+2)) (:+, Any[1, 2], Any[])
Sorry, something went wrong.
No branches or pull requests
is the only example, which doesn't show why I would want to use it.
The text was updated successfully, but these errors were encountered: