Sha256: 7dd45bcecf9083cad5ec3093c9e16e8f93eb8dec3c66f586da6e9bd39194390d
Contents?: true
Size: 594 Bytes
Versions: 396
Compression:
Stored size: 594 Bytes
Contents
#lang racket (provide response-for) (define (response-for phrase) (cond [(silent? phrase) "Fine. Be that way!"] [(shouting? phrase) "Whoa, chill out!"] [(question? phrase) "Sure."] [else "Whatever."])) (define (silent? phrase) (or (null? phrase) (equal? (string-normalize-spaces phrase) ""))) (define (shouting? phrase) (and (equal? (string-upcase phrase) phrase) (ormap (lambda (x) (char-alphabetic? x)) (string->list phrase)))) (define (question? phrase) (char=? #\? (string-ref phrase (- (string-length phrase) 1))))
Version data entries
396 entries across 396 versions & 1 rubygems