3 ms·
;; comparing with racket: (define (grade student) (cond [(excellent-work student) "A+"] [(and (okay-stuff student) (tried-hard student)) "
by bad_login 12y ago
;; comparing with racket:
(define (grade student)
(cond
[(excellent-work student) "A+"]
[(and (okay-stuff student) (tried-hard student)) "B"]
[(okay-stuff student) "B-"]
[else "C"]))
;; Or
(require racket/match)
(define (grade student)
(match (map (lambda (fn) (fn student))
'(excellent-work okay-stuff tried-hard))
[(list #t _ _) "A+"]
[(list _ #t #t) "B"]
[(list _ #t _) "B-"]
[else "C"]))