How to resolve the algorithm 99 bottles of beer step by step in the Frege programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm 99 bottles of beer step by step in the Frege programming language

Table of Contents

Problem Statement

Display the complete lyrics for the song:     99 Bottles of Beer on the Wall.

The lyrics follow this form: ... and so on, until reaching   0     (zero). Grammatical support for   1 bottle of beer   is optional. As with any puzzle, try to do it in as creative/concise/comical a way as possible (simple, obvious solutions allowed, too).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm 99 bottles of beer step by step in the Frege programming language

Source code in the frege programming language

module Beer where

main = mapM_ (putStrLn . beer) [99, 98 .. 0]
beer 1 = "1 bottle of beer on the wall\n1 bottle of beer\nTake one down, pass it around"
beer 0 = "better go to the store and buy some more."
beer v = show v ++ " bottles of beer on the wall\n"
                ++ show v
                ++ " bottles of beer\nTake one down, pass it around\n"
                ++ head (lines $ beer $ v-1) ++ "\n"

  

You may also check:How to resolve the algorithm Circular primes step by step in the Sidef programming language
You may also check:How to resolve the algorithm Draw a rotating cube step by step in the Julia programming language
You may also check:How to resolve the algorithm Horner's rule for polynomial evaluation step by step in the REXX programming language
You may also check:How to resolve the algorithm Deconvolution/1D step by step in the RPL programming language
You may also check:How to resolve the algorithm Rock-paper-scissors step by step in the Wren programming language