Skip to content

Instantly share code, notes, and snippets.

@ryanbriones
Forked from redsquirrel/gist:189193
Created September 25, 2009 03:25
Show Gist options
  • Save ryanbriones/193272 to your computer and use it in GitHub Desktop.
Save ryanbriones/193272 to your computer and use it in GitHub Desktop.
SICP Exercise 1.4
;; SICP 1.4
;; Fork me. Solve me.
;; ====
(define (a-plus-abs-b a b)
((if (> b 0) + -) a b))
(a-plus-abs-b 1 2)
;; ((if (> 2 0) + -) 1 2)
;; (+ 1 2)
;; => 3
(a-plus-abs-b 3 -4)
;; ((if (> -4 0) + -) 3 -4)
;; (- 3 -4)
;; => 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment