6 people like it.

99 Bottles of Beer on the Wall

263 bytes (unix line endings ;))

let c,d,e="bottles","bottle"," of beer on the wall"
for b=99 downto 1 do[d,"Go to the store and buy some more, ",99;c,"Take one down and pass it around, ",b-1].[sign(b-1)]|>fun(x,y,z)->printfn"%i %s%s, %i %s of beer.\n%s%i %s%s.\n"b x e b x y z [d;c].[sign(z-1)]e
val c : string

Full name: Script.c
val d : string

Full name: Script.d
val e : string

Full name: Script.e
val b : int
val sign : value:'T -> int (requires member get_Sign)

Full name: Microsoft.FSharp.Core.Operators.sign
val x : string
val y : string
val z : int
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Raw view Test code New version

More information

Posted:9 years ago
Author:Simon Dickson
Tags: f# , code golf , beer