Sha256: c895528c20927a45467eebfb480d34122d11680d0668ed12e1d8784f947db57f
Contents?: true
Size: 705 Bytes
Versions: 396
Compression:
Stored size: 705 Bytes
Contents
(define-module (bob) #:export (response-for)) (define shouting? (lambda (phrase) (and (string-any char-alphabetic? phrase) (string-every char-upper-case? (string-filter char-alphabetic? phrase))))) (define question? (lambda (phrase) (char=? #\? (string-ref phrase (- (string-length phrase) 1))))) (define silent? (lambda (phrase) (or (string-null? phrase) (string-every char-whitespace? phrase)))) (define response-for (lambda (phrase) (cond ((silent? phrase) "Fine. Be that way!") ((shouting? phrase) "Whoa, chill out!") ((question? phrase) "Sure.") (else "Whatever."))))
Version data entries
396 entries across 396 versions & 1 rubygems