new tasks
This commit is contained in:
parent
2a4d27cea0
commit
80737d5a6a
1194 changed files with 15353 additions and 1 deletions
5
Task/Assertions/Racket/assertions-2.rkt
Normal file
5
Task/Assertions/Racket/assertions-2.rkt
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#lang racket
|
||||
|
||||
(define x 80)
|
||||
(unless (= x 42)
|
||||
(error "a is not 42")) ; will error
|
||||
13
Task/Assertions/Racket/assertions.rkt
Normal file
13
Task/Assertions/Racket/assertions.rkt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#lang racket
|
||||
|
||||
(define/contract x
|
||||
(=/c 42) ; make sure x = 42
|
||||
42)
|
||||
|
||||
(define/contract f
|
||||
(-> number? (or/c 'yes 'no)) ; function contract
|
||||
(lambda (x)
|
||||
(if (= 42 x) 'yes 'no)))
|
||||
|
||||
(f 42) ; succeeds
|
||||
(f "foo") ; contract error!
|
||||
Loading…
Add table
Add a link
Reference in a new issue