egraphs-good / egglog

egraphs + datalog!
https://egraphs-good.github.io/egglog/
MIT License
400 stars 45 forks source link

Step through by block for slideshow mode #374

Closed yihozhang closed 3 months ago

yihozhang commented 3 months ago

Right now the step-throughs in the slideshow mode go command by command, which gets tedious if several commands should be introduced together (e.g., a set of algebraic rules)

oflatt commented 3 months ago

What is the new behavior? I don't understand the changes, particularly the line counting if

yihozhang commented 3 months ago

Let's use this program as an example:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; An Expr datatype
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(datatype Expr
  (Num i64)
  (Var String)
  (Add Expr Expr)
  (Mul Expr Expr))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Some constants
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(let zero (Num 0))
(let one (Num 1))
(let two (Num 2))
(let one-plus-two (Add one two))

In the old behavior, You need to click Next 5 times. In the new behavior, you only need to click next twice (a command is in a new block if it is separated by more than one newline character). @oflatt