Skip to content

Instantly share code, notes, and snippets.

View kristianlm's full-sized avatar

Kristian Lein-Mathisen kristianlm

View GitHub Profile
@kristianlm
kristianlm / constant folding.scm
Created January 2, 2024 20:43
s-expression constant folding experiment
(import test matchable)
;; how to turn
`(* 2 (+ x 3 (+ 4 10)) y 10)
;; into `(* 20 (+ 17 x ) y) ?
`(+ (+ 1 2 x) (+ 3 4 x) 5) =>
`(+ 15 x x)
(begin