in the exercism surrouding it delivers something else:
bob("FCÄEÜCÖDFCßAB")
"Whoa, chill out!
the code
function bob(stimulus="") # Comprehension
stimulus = strip(stimulus) #remove whitespaces at the end after '?' (not at last position)
if all(isspace, stimulus) # map style, function isspace includes also ""
return "Fine. Be that way!"
else
b_question = false
# stimulus contains '?' at the end?
b_question=last(stimulus) == '?'
b_yell = false
# at least one letter/ all of them uppercase?
if any(isuppercase(c) for c in stimulus)
b_yell = true
end
# ALL letters uppercase or punctiation, space, digits or ASCII and not Lowercase?
# isascii(c) && !islowercase(c) true for "%^*@\$(*^"
b_yell = b_yell && all(ispunct(c) || isspace(c) || isdigit(c) || isletter(c) && isuppercase(c) || isascii(c) &&
!islowercase(c) for c in stimulus) # Comprehension
if b_question
if b_yell
return "Calm down, I know what I'm doing!"
else
return "Sure."
end
elseif b_yell
return "Whoa, chill out!"
else
return "Whatever."
end
end
end
I’m looking forward to read your answers/comments to that
This isn’t a test case in the upstream problem-specifications so this was one added by the maintainers. I agree though that this test is misclassified as a yell since ß is a lowercase letter.
Edit - Given the visual similarity between ß and ẞ, I think using a different letter with more distinct lowercase and uppercase versions would avoid confusion for students.
Yeah, it was only officially adopted a decade ago, and even then the recommendation at the time was to write SS instead. I’m not a German speaker so I don’t know how common ẞ is nowadays.
I’m also not a native speaker, but I know it varies geographically. I learned German when I lived in Basel back in the 1980’s, and the Swiss wanted nothing to do with this spelling. It was a lot more common just across the German border (only 4 km from my apartment).
To summarize, the ẞ used for that particular test case is correctly interpreted as uppercased in both the REPL and in the Exercism test runner. Because all letters are uppercased in that test case, the test is correct in that Bob is yelling. Therefore, no change is needed at this point. Correct?
well actually I’d say NO
now,
as an uppercase ß is possible…
but not used in german language…
So I would recommend to changing the test case to
either
bob(“FCÄEÜCÖDFCßAB”) # (lowercase)
or putting the ‘ẞ’ to the beginning, to make it more clear!:
bob(“ẞFCÄEÜCÖDFCAB”) # (uppercase)