filecoin-project / orient

↻Observe-Orient-Decide-Act↩
MIT License
18 stars 6 forks source link

Support unwrapping of nested constraints. #35

Closed porcuquine closed 5 years ago

porcuquine commented 5 years ago

Support for unwrapping constraint definitions. This works transparently, expanding like so:

ORIENT> (unwrap-constraint-definitions '((layers (+ (+ (* 2 (log (/ 1 (* 3 (- epsilon (* 2 delta)))) 2))
                               (* 2 (/ (- 0.8 (+ epsilon delta))
                                   (- 0.12 (* 2 delta)))))
                          2))))

((TMP7% (* 2 DELTA))
 (TMP6% (- EPSILON TMP7%))
 (TMP5% (* 3 TMP6%))
 (TMP4% (/ 1 TMP5%))
 (TMP3% (LOG TMP4% 2))
 (TMP2% (* 2 TMP3%))
 (TMP11% (+ EPSILON DELTA))
 (TMP10% (- 0.8 TMP11%))
 (TMP13% (* 2 DELTA))
 (TMP12% (- 0.12 TMP13%))
 (TMP9% (/ TMP10% TMP12%))
 (TMP8% (* 2 TMP9%))
 (TMP1% (+ TMP2% TMP8%))
 (LAYERS (+ TMP1% 2)))