How to resolve the algorithm The Twelve Days of Christmas step by step in the PicoLisp 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 PicoLisp 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 PicoLisp programming language
Source code in the picolisp programming language
(de days
first second third fourth fifth sixth
seventh eight ninth tenth eleventh twelfth )
(de texts
"A partridge in a pear tree."
"Two turtle doves and"
"Three french hens"
"Four calling birds"
"Five golden rings"
"Six geese a-laying"
"Seven swans a-swimming"
"Eight maids a-milking"
"Nine ladies dancing"
"Ten lords a-leaping"
"Eleven pipers piping"
"Twelve drummers drumming" )
(for (X . Day) days
(prinl "On the " Day " day of Christmas")
(prinl "My true love game to me:")
(for (Y X (gt0 Y) (dec Y))
(prinl
(if (and (= 12 X) (= 1 Y))
"And a partridge in a pear tree."
(get texts Y)) ) )
(prinl) )
(bye)
You may also check:How to resolve the algorithm Empty directory step by step in the Elixir programming language
You may also check:How to resolve the algorithm GUI/Maximum window dimensions step by step in the XPL0 programming language
You may also check:How to resolve the algorithm Wordle comparison step by step in the Wren programming language
You may also check:How to resolve the algorithm ISBN13 check digit step by step in the Phix programming language
You may also check:How to resolve the algorithm Averages/Simple moving average step by step in the Pony programming language