-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Running the program
prog = compile_pgcl("""
const c := 42
nat x
x := c : 1/2 + 2 : 1/2
x := c
""")
print(prog)gives the following output:
const c := 42;
nat x;
x := c : 1/2 + 2 : 1/2;
x := 42;
The constant in the categorical expression isn't substituted. This happens because the different subexpressions in a CategoricalExpr aren't stored as top-level attributes (sensible), but in a list of subexpressions with probabilities. This however means that the built-in walk over the expression doesn't yield these subexpressions due to the way children are discovered in mut_expr_children.
I already changed this on the brand-new branch to enable walking over the parameters of a function call. However, the problem with CategoricalExprs persists, as their subexpressions are stored in tuples, which are immutable and thus don't allow for substitution.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working