Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Comma-quibbling/CLU/comma-quibbling.clu
Normal file
30
Task/Comma-quibbling/CLU/comma-quibbling.clu
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
quibble = proc (words: array[string]) returns (string)
|
||||
out: string := "{"
|
||||
last: int := array[string]$high(words)
|
||||
|
||||
for i: int in array[string]$indexes(words) do
|
||||
out := out || words[i]
|
||||
if i < last-1 then
|
||||
out := out || ", "
|
||||
elseif i = last-1 then
|
||||
out := out || " and "
|
||||
end
|
||||
end
|
||||
return(out || "}")
|
||||
end quibble
|
||||
|
||||
start_up = proc ()
|
||||
as = array[string]
|
||||
aas = array[as]
|
||||
po: stream := stream$primary_output()
|
||||
|
||||
testcases: aas := aas$
|
||||
[as$[],
|
||||
as$["ABC"],
|
||||
as$["ABC","DEF"],
|
||||
as$["ABC","DEF","G","H"]]
|
||||
|
||||
for testcase: as in aas$elements(testcases) do
|
||||
stream$putl(po, quibble(testcase))
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue