# How do I make a dispatch table using multiple dispatch instead of Dict?

**URL:** <https://discourse.julialang.org/t/how-do-i-make-a-dispatch-table-using-multiple-dispatch-instead-of-dict/60784>\
**Category:** General Usage\
**Created:** [May 8, 2021, 3:55pm UTC](https://discourse.julialang.org/t/how-do-i-make-a-dispatch-table-using-multiple-dispatch-instead-of-dict/60784 "2021-05-08T15:55:50Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 9, 2021, 8:03am UTC](https://discourse.julialang.org/t/how-do-i-make-a-dispatch-table-using-multiple-dispatch-instead-of-dict/60784/21 "2021-05-09T08:03:37Z")

</div>

You can hoist everything into type space, as in

```julia
vrr(::Val{(0,0)}) = :ss
vrr(::Val{(0,1)}) = :sp
vrr(::Val{(1,0)}) = :ps
const KEYS = (Val((0,0)), Val((0,1)), Val((1,0)))
map(vrr, KEYS)

```

but it may be very taxing on the compiler, so it would be a solution of last resort for me.

> [@rpmuller](#):
>
> Do I have a faster routine for a system for angular momenta (a,c)?
> 
> - If so, call that routine
> - If not, continue with the standard code.

I am still not sure I understand the context, but

1. if you can decide this based on the type of `a` and `c`, just use the built-in dispatch of the language,
2. if not, use branches (`if`).

---

_[View the full topic](https://discourse.julialang.org/t/how-do-i-make-a-dispatch-table-using-multiple-dispatch-instead-of-dict/60784)._
