Skip to content

Commit 0dbb348

Browse files
Allow printing expr as it changes when running rules
1 parent 2adc98a commit 0dbb348

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python/egglog/egraph.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,10 +1377,14 @@ def saturate(
13771377
"""
13781378
Saturate the egraph, running the given schedule until the egraph is saturated.
13791379
It serializes the egraph at each step and returns a widget to visualize the egraph.
1380+
1381+
If an `expr` is passed, it's also extracted after each run and printed
13801382
"""
13811383
from .visualizer_widget import VisualizerWidget
13821384

13831385
def to_json() -> str:
1386+
if expr is not None:
1387+
print(self.extract(expr), "\n")
13841388
return self._serialize(**kwargs).to_json()
13851389

13861390
egraphs = [to_json()]

0 commit comments

Comments
 (0)