-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace eval with macros #12
Comments
Would there be any advantage of using a non-standard string literal over a macro? algo = compile"problems/asia/asia.uai"
obsvars, obsvals = Int64[], Int64[]
marginals = run_algo(algo, obsvars, obsvals) |
It looks good. The problem is how to include also uai_evid_filepath. |
Right. You have a point. But putting aside the extra arguments that we might want to pass to |
It is easy to do, just create a macro like the following julia> using MLStyle
julia> macro m(ex1, kwargs...)
d = Dict()
for kw in kwargs
@match kw begin
:($a = $b) => begin
d[a] = b
end
end
end
d
end
@m (macro with 1 method)
julia> @m a b=3 c=5
Dict{Any, Any} with 2 entries:
:b => 3
:c => 5 |
Ahh, macros do support |
There is an issue with how the macro evaluates the One approach to solve this is to pass the problem name to the macro as a uai_filepath = joinpath(problem_dir, problem * ".uai")
... But this would have a negative impact on the interface for constructing the posterior marginals algorithms, as it would be unable to handle variables with bounded values. |
The minimum fix should be like
The text was updated successfully, but these errors were encountered: