Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/The-Name-Game/Jq/the-name-game.jq
Normal file
23
Task/The-Name-Game/Jq/the-name-game.jq
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
def capitalize:
|
||||
if length==0 then .
|
||||
else .[0:1] as $c
|
||||
| ($c|ascii_upcase) as $C
|
||||
| if $c == $C then .
|
||||
else $C + .[1:]
|
||||
end
|
||||
end;
|
||||
|
||||
def printVerse:
|
||||
{x: (ascii_downcase|capitalize)}
|
||||
| .x[0:1] as $x0
|
||||
| .y = (if $x0|test("[AEIOU]") then .x | ascii_downcase else .x[1:] end)
|
||||
| .b = ((select($x0 == "B") | "") // "b")
|
||||
| .f = ((select($x0 == "F") | "") // "f")
|
||||
| .m = ((select($x0 == "M") | "") // "m")
|
||||
| "\(.x), \(.x), bo-\(.b)\(.y)",
|
||||
"Banana-fana fo-\(.f)\(.y)",
|
||||
"Fee-fi-mo-\(.m)\(.y)",
|
||||
"\(.x)!\n" ;
|
||||
|
||||
"Gary", "Earl", "Billy", "Felix", "Mary", "Steve"
|
||||
| printVerse
|
||||
Loading…
Add table
Add a link
Reference in a new issue