Skip to content

Instantly share code, notes, and snippets.

@fogus
Created June 28, 2010 16:28
Show Gist options
  • Save fogus/456056 to your computer and use it in GitHub Desktop.
Save fogus/456056 to your computer and use it in GitHub Desktop.
(defconstrainedfn doubler
"Defines a function that doubles its input."
([n]
:requires
(number? n)
:ensures
(= (* 2 n) %)
:body
(* 2 n))
([x y]
:requires
(every? number? [x y])
:ensures
(number? %)
(= (* 2 (+ x y)) %)
:body
(* 2 (+ x y))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment