Sha256: adb59492cc51e6464085a51cd219ec18f9b40481f72e9d64bdf81a48805930fe
Contents?: true
Size: 918 Bytes
Versions: 66
Compression:
Stored size: 918 Bytes
Contents
module Bob exposing (hey) import Regex import String hey : String -> String hey remark = if isShouting remark && isQuestion remark then "Calm down, I know what I'm doing!" else if isShouting remark then "Whoa, chill out!" else if isQuestion remark then "Sure." else if isSilence remark then "Fine. Be that way!" else "Whatever." isShouting : String -> Bool isShouting remark = isUppercase remark && hasCharacters remark isUppercase : String -> Bool isUppercase remark = remark == String.toUpper remark isQuestion : String -> Bool isQuestion remark = String.endsWith "?" remark hasCharacters : String -> Bool hasCharacters remark = Regex.contains characterRegex remark characterRegex : Regex.Regex characterRegex = Regex.regex "[a-zA-Z]" isSilence : String -> Bool isSilence remark = String.isEmpty (String.trim remark)
Version data entries
66 entries across 66 versions & 1 rubygems