Skip to content

Commit 73f528f

Browse files
Fix docs
1 parent 8d4ae61 commit 73f528f

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

docs/reference/egglog-translation.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ path_ruleset = egraph.ruleset("path")
311311
# (rule ((edge x y))
312312
# ((path x y)) :ruleset path)
313313
x, y = vars_("x y", i64)
314-
path_ruleset.register(rule(edge(x, y)).then(path(x, y)))
314+
x, y = vars_("x y", i64)
315+
egraph.register(rule(edge(x, y), ruleset=path_ruleset).then(path(x, y)))
315316
```
316317

317318
### Rewrites
@@ -348,8 +349,7 @@ Rulsets can be run as well, by calling the `run` method on them:
348349

349350
```{code-cell} python
350351
# egg: (run 10 :ruleset path)
351-
run_report = path_ruleset.run(10)
352-
run_report
352+
egraph.run(10, ruleset=path_ruleset)
353353
```
354354

355355
After a run, you get a run report, with some timing information as well as whether things were updated.
@@ -406,19 +406,18 @@ step_egraph.register(left(i64(0)), right(i64(0)))
406406
x, y = vars_("x y", i64)
407407
408408
step_left = step_egraph.ruleset("step-left")
409-
step_left.register(
409+
step_right = step_egraph.ruleset("step-right")
410+
step_egraph.register(
410411
rule(
411412
left(x),
412413
right(x),
413-
).then(left(x + 1))
414-
)
415-
416-
step_right = step_egraph.ruleset("step-right")
417-
step_right.register(
414+
ruleset=step_left
415+
).then(left(x + 1)),
418416
rule(
419417
left(x),
420418
right(y),
421419
eq(x).to(y + 1),
420+
ruleset=step_right
422421
).then(right(x))
423422
)
424423

python/egglog/egraph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,15 @@ def output(self) -> None:
610610
raise NotImplementedError("Not imeplemented yet, because there are no examples in the egglog repo")
611611

612612
@overload
613-
def run(self, limit: int, ruleset: Optional[Ruleset] = None, /, *until: Fact) -> bindings.RunReport:
613+
def run(self, limit: int, /, *until: Fact, ruleset: Optional[Ruleset] = None) -> bindings.RunReport:
614614
...
615615

616616
@overload
617617
def run(self, schedule: Schedule, /) -> bindings.RunReport:
618618
...
619619

620620
def run(
621-
self, limit_or_schedule: int | Schedule, ruleset: Optional[Ruleset] = None, /, *until: Fact
621+
self, limit_or_schedule: int | Schedule, /, *until: Fact, ruleset: Optional[Ruleset] = None
622622
) -> bindings.RunReport:
623623
"""
624624
Run the egraph until the given limit or until the given facts are true.

0 commit comments

Comments
 (0)