Created
June 28, 2010 16:28
-
-
Save fogus/456056 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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