Sha256: e5725884ffdccfd175194336ad43874312b7e2485cbbbbd2053820aa8b58b03c

Contents?: true

Size: 828 Bytes

Versions: 396

Compression:

Stored size: 828 Bytes

Contents

(ns beer-song
  (:require [clojure.string :as str]))

(defn many [n] (format "%d bottles of beer on the wall, %d bottles of beer.\nTake one down and pass it around, %d bottles of beer on the wall.\n" n n (dec n)))

(def two "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n")
(def one "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n")
(def zero "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n")

(defn verse [v]
  (case (int v)
    0 zero
    1 one
    2 two
    (many v)))

(defn sing
  ([n]   (sing n 0))
  ([n m] (->> (range n (dec m) -1)
              (map verse)
              (str/join "\n"))))

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.179 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.178 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.177 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.176 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.175 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.174 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.173 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.172 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.171 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.170 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.169 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.167 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.166 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.165 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.164 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.163 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.162 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.161 tracks/clojure/exercises/beer-song/src/example.clj
trackler-2.2.1.160 tracks/clojure/exercises/beer-song/src/example.clj