How to resolve the algorithm Comma quibbling step by step in the Lasso programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Comma quibbling step by step in the Lasso programming language
Table of Contents
Problem Statement
Comma quibbling is a task originally set by Eric Lippert in his blog.
Write a function to generate a string output which is the concatenation of input words from a list/sequence where:
Test your function with the following series of inputs showing your output here on this page:
Note: Assume words are non-empty strings of uppercase characters for this task.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Comma quibbling step by step in the Lasso programming language
Source code in the lasso programming language
#!/usr/bin/lasso9
local(collection =
array(
array,
array("ABC"),
array("ABC", "DEF"),
array("ABC", "DEF", "G", "H")
)
)
with words in #collection do {
if(#words -> size > 1) => {
local(last = #words -> last)
#words -> removelast
stdoutnl('{' + #words -> join(', ') + ' and ' + #last'}')
else(#words -> size == 1)
stdoutnl('{' + #words -> first + '}')
else
stdoutnl('{}')
}
}
You may also check:How to resolve the algorithm Sorting Algorithms/Circle Sort step by step in the Action! programming language
You may also check:How to resolve the algorithm Babbage problem step by step in the Scheme programming language
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the MiniZinc programming language
You may also check:How to resolve the algorithm Calendar step by step in the Ring programming language
You may also check:How to resolve the algorithm Bioinformatics/base count step by step in the EasyLang programming language