Method dispatch based on pattern matching for Julia