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

Interface to match with a list of patterns #23

Open
MasonProtter opened this issue Sep 30, 2019 · 0 comments
Open

Interface to match with a list of patterns #23

MasonProtter opened this issue Sep 30, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@MasonProtter
Copy link

Currently, it seems the only API to use pattern matching with this package is with the provided macros. However, sometimes I want to generate a list of patterns and then do pattern matching using those instead of manually writing out all my patterns inside the macro.

It'd be really great if there was an API to do something like this:

const global_pats = [:(_::String   => :string)
                     :([a,a,a]     => (:all_the_same, a))
                     :([a,bs...,c] => (:at_least_2, a, bs, c))]

f(x) = match(x, global_pats)

julia> f("foo")
:string
@ghost ghost added the enhancement New feature or request label Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant