Skip to content

Instantly share code, notes, and snippets.

@sudoankit
Created February 14, 2019 10:42
Show Gist options
  • Save sudoankit/201ecd896c7d28db5aa4cddfff2a1248 to your computer and use it in GitHub Desktop.
Save sudoankit/201ecd896c7d28db5aa4cddfff2a1248 to your computer and use it in GitHub Desktop.
My solution to Exercise 1.2 of SICP
;; Write the expression in prefix form.
;;
;; 5 + 4 + ( 2 - ( 3 - ( 6 + 4/5 ) ) )
;; -------------------------------------
;; 3 * ( 6 - 2 ) * (2 - 7 )
;;
;; A:
;; ( / ( + 5 4 (- 2 (- 3 (+ 6 (/ 4 5 ) ) ) ) )
;; ( * 3 (- 6 2 ) (- 2 7 ) ) )
;;
1 ]=> ( / ( + 5 4 (- 2 ( - 3 ( + 6 ( / 4 5 ) ) ) ) )
( * 3 ( - 6 2 ) (- 2 7 ) ) )
;Value: -37/150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment