I want to generate something like an if-elseif-else construct or 
switch-case programmatically.

The use I have in mind is to write an expression for taking a step in a 
random walk in n dimensions,
so I need 2*n branches.

The solution I found is not very readable. I wonder if there is an easier 
way to do it.

The function to generate the code is here 
https://gist.github.com/jlapeyre/66c7714f22c66123add5db0accf1f01d
The application to a random walk step is here 
https://gist.github.com/jlapeyre/b93bead293f903b6afb1cc5d4bd14d13


Reply via email to