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

Version Path
trackler-2.2.1.180 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.179 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.178 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.177 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.176 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.175 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.174 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.173 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.172 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.171 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.170 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.169 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.167 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.166 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.165 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.164 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.163 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.162 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.161 tracks/racket/exercises/bob/example.rkt
trackler-2.2.1.160 tracks/racket/exercises/bob/example.rkt