No, Julia only dispatches on types not on values.  The latter sometimes
goes under the name of pattern matching.  There is a package for that:
https://github.com/toivoh/PatternDispatch.jl

On Tue, 2015-09-15 at 10:15, Michael Borregaard <mkborrega...@gmail.com> wrote:
> Is there a way in julia to restrict the values of arguments to a function, 
> eg to the contents of a certain vector?
>
> So, e.g. method in the function 
>
> function foo(x, method::String) ...
>
> would be constrained to either "spearman", "pearson" or "kendall"?
>
> Thanks

Reply via email to