-
Notifications
You must be signed in to change notification settings - Fork 162
Open
Description
Currently, pretty-printing for choicemaps does not attempt to sort the addresses of leaf-nodes or submaps before printing them:
Lines 126 to 137 in 18c06fd
for (key, value) in key_and_values | |
# For strings, `print` is what we want; `Base.show` includes quote marks. | |
# https://docs.julialang.org/en/v1/base/io-network/#Base.print | |
print(io, indent_vert_str) | |
print(io, (cur == n ? indent_last_str : indent_str) * "$(repr(key)) : $value\n") | |
cur += 1 | |
end | |
for (key, submap) in key_and_submaps | |
print(io, indent_vert_str) | |
print(io, (cur == n ? indent_last_str : indent_str) * "$(repr(key))\n") | |
_show_pretty(io, submap, pre + 4, cur == n ? (vert_bars...,) : (vert_bars..., pre+1)) | |
cur += 1 |
This leads to confusing output for choicemaps produced by the dynamic modeling language, especially those that involve for loops -- the addresses are not sorted by timesteps, and so it's not as easy to parse what's in the choicemap.
Fixing won't be hard -- we just need to sort the keys before printing, taking care to handle addresses which don't have ordering functions (Base.:<
) defined for them.
Metadata
Metadata
Assignees
Labels
No labels