Sha256: 3c1d2bf59a6aa876fb2920826aee2ed7f968ab753b7ebbcf15e6a736fc94cf74
Contents?: true
Size: 728 Bytes
Versions: 68
Compression:
Stored size: 728 Bytes
Contents
open Base let bottles = function | 0 -> "no more bottles" | 1 -> "1 bottle" | n -> Int.to_string n ^ " bottles" let line1 n = let b = bottles n in Printf.sprintf "%s of beer on the wall, %s of beer.\n" b b let line2 n = Printf.sprintf "Take %s down and pass it around, %s of beer on the wall.\n" (if n > 0 then "one" else "it") (bottles n) let verse = function | 0 -> String.capitalize (line1 0) ^ "Go to the store and buy some more, 99 bottles of beer on the wall.\n" | n -> line1 n ^ line2 (n-1) let lyrics ~from:from ~until:until = List.map (List.range ~stride:(-1) ~stop:`inclusive from until) ~f:(fun n -> verse n) |> String.concat ~sep:"\n"
Version data entries
68 entries across 68 versions & 1 rubygems