(A Creative Blog Name Here)

Code, math, and other things I find useful

Types as function arguments in Julia

The multiple dispatch mechanism in Julia makes passing types as arguments to functions desirable. This technique is sometimes referred to as "types as tags" and a contrived example is presented below.

type A

type B

f(::Type{A}) = println("f with type A")
f(::Type{B}) = println("f ...