[julia-users] strategy design pattern

2016-04-06 Thread Tomas Lycken
Multiple dispatch is actually really well suited for this. The idiomatic approach in Julia is quite similar to your c++ example, at least conceptually: immutable Foo end immutable Bar end alg(::Type{Foo}) = println("I'm using foo") alg(::Type{Bar}) = println("I'm using bar") strategy = Foo #

[julia-users] strategy design pattern

2016-04-05 Thread Igor Cerovsky
Hi, By exploring Julia I'm curios what would be a best way to implement strategy design pattern in Julia. I'm posting a C++ example, for which I would like to write equivalent in Julia. Thanks. #include #include #include template void foo_t(const T& t) { std::cout << "I'm using foo_t... \