Skip to content

Instantly share code, notes, and snippets.

@lojic
Created July 22, 2014 20:53
Show Gist options
  • Save lojic/18fd65c12f25c8c0c46f to your computer and use it in GitHub Desktop.
Save lojic/18fd65c12f25c8c0c46f to your computer and use it in GitHub Desktop.
contract example
;; Step 1
(define (valid? a)
(< a 10))
(define/contract (foo a b)
(->i ([x valid?] [y any/c]) any)
(+ a b))
;; Step 2
(define (valid? max a)
(< a max))
(define/contract (foo a b)
(->i ([x (curry valid? 10)] [y any/c]) any)
(+ a b))
;; Step 3
(define (valid? max a)
(< a max))
(define/contract (foo a b)
(->i ([x (y) (curry valid? y)] [y any/c]) any)
(+ a b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment