Is there any way of implementing “literate programming style macro” in
Weave.jl? My goal is to write a tutorial-style literate program in a logical order for the human reader. For example:
# Here is a complicated thing that we want to do. Given two numbers `a` and `b`, # we want to add them and store them in `c`. <some_complicated_thing>= c = a + b # But to do that, we first need to verify where a particular condition # on `a, b` holds. <my_condition>= a == 1 && b == 2 # Here is the function that does everything in one shot. function complicated_function(a,b) if <my_condition> <some_complicated_thing> end return c end
The function above should be the same as:
function complicated_function(a,b) if a == 1 && b == 2 c = a + b end return c end
Is there a way of executing something similar in
Weave.jl? Any tips will be much appreciated!