Last active
February 5, 2020 22:15
-
-
Save PaulMaynard/fb0a977fd2260e2b1e66e6562bba0b82 to your computer and use it in GitHub Desktop.
This file contains 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
(require rackunit) | |
; lambda | |
(check-true (lambda? '(lambda (x) x))) | |
(check-true (lambda? '(lambda (x y z) z y x))) | |
(check-false (lambda? '(lambda (x 1) x))) | |
(check-false (lambda? '(lambda (x)))) | |
(check-false (lambda? '3)) | |
(check-equal? '(x) (lambda-params '(lambda (x) y))) | |
(check-equal? '(y) (lambda-body '(lambda (x) y))) | |
; apply | |
(check-false (apply? '(lambda (x) x))) | |
(check-false (apply? '(define x 1))) | |
(check-false (apply? 'x)) | |
(check-false (apply? '(x))) | |
(check-true (apply? '(x y))) | |
(check-true (apply? '(x y z))) | |
(check-equal? 'x (apply-func '(x y))) | |
(check-equal? '(y) (apply-args '(x y))) | |
; define | |
(check-true (define? '(define x 3))) | |
(check-true (define-basic? '(define x 3))) | |
(check-false (define-basic? '(define (x) 3))) | |
(check-false (define-func? '(define x 3))) | |
(check-true (define-func? '(define (x) 3))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment