How to resolve the algorithm The Twelve Days of Christmas step by step in the q programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm The Twelve Days of Christmas step by step in the q programming language
Table of Contents
Problem Statement
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Let's start with the solution:
Step by Step solution about How to resolve the algorithm The Twelve Days of Christmas step by step in the q programming language
Source code in the q programming language
days:" "vs"first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth"
gifts:(
"Twelve drummers drumming";
"Eleven pipers piping";
"Ten lords a-leaping";
"Nine ladies dancing";
"Eight maids a-milking";
"Seven swans a-swimming";
"Six geese a-laying";
"Five golden rings";
"Four calling birds";
"Three french hens";
"Two turtle doves";
"And a partridge in a pear tree.";
"")
verses:stanza 0 1,/:{(reverse x)+2+til each 2+x}til 12
lyric:raze .[;0 2;{"A",5_x}] verses{@[x;0;ssr[;"twelfth";y]]}'days
1 "\n"sv lyric; // print
You may also check:How to resolve the algorithm Honaker primes step by step in the Pascal programming language
You may also check:How to resolve the algorithm Range consolidation step by step in the Clojure programming language
You may also check:How to resolve the algorithm Vector step by step in the Modula-2 programming language
You may also check:How to resolve the algorithm Inheritance/Single step by step in the M2000 Interpreter programming language
You may also check:How to resolve the algorithm Look-and-say sequence step by step in the Rust programming language