Sha256: c5e403a4880440b21e450a019fe5e67bd26598978a4e242a0ac049b3e6d054ec

Contents?: true

Size: 468 Bytes

Versions: 113

Compression:

Stored size: 468 Bytes

Contents

open Core

let is_empty = String.for_all ~f:Char.is_whitespace

let is_shouting s =
  String.exists ~f:Char.is_alpha s &&
  String.for_all ~f:(fun c -> not (Char.is_alpha c) || Char.is_uppercase c) s

let is_question s = String.is_suffix ~suffix:"?" (String.strip s)

let response_for = function
  | s when is_empty s    -> "Fine. Be that way!"
  | s when is_shouting s -> "Whoa, chill out!"
  | s when is_question s -> "Sure."
  | _                    -> "Whatever."

Version data entries

113 entries across 113 versions & 1 rubygems

Version Path
trackler-2.2.1.32 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.31 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.30 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.29 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.28 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.27 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.26 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.25 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.24 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.23 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.22 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.21 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.20 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.19 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.18 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.17 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.16 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.15 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.14 tracks/ocaml/exercises/bob/example.ml
trackler-2.2.1.13 tracks/ocaml/exercises/bob/example.ml