Language Mathematica
Date: | 02/27/06 |
Author: | Konstantin Kouptsov |
URL: | n/a |
Comments: | 0 |
Info: | http://www.wolfram.com |
Score: | (2.58 in 12 votes) |
(* Mathematica code *) (* by Konstantin Kouptsov *) With[{ m = "no more", b = " bottle", e = " of beer", w = " on the wall", n = "\n", d = "Take one down and pass it around, ", g = "Go to the store and buy some more, " }, NoMore[x_, y_] := If[x > 0, ToString[x], y]; Plural[x_] := If[x == 1, "", "s"]; StringJoin[MapThread[ Function[{p, q, r}, StringJoin[{ NoMore[p, "No more"], b, Plural[p], e, w, ", ", NoMore[q, m], b, Plural[q], e, ". ", n, If[q > 0, d, g], NoMore[r, m], b, Plural[r], e, w, ".", If[p > 0, n <> n, ""]}]], {#, #, RotateLeft[#]} &[Range[99, 0, -1]]]]]
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
Very short version. | Brenton Bostick | 03/16/06 | 1 | |
Easily extensible, English-speaking | Szabolcs Horvát | 03/04/08 | 0 | |
3 | Anonymous | 04/20/05 | 0 |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments