Created
February 24, 2010 17:51
-
-
Save tmountain/313654 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/clj | |
(use 'clojure.contrib.str-utils) | |
(def breads ["rye" "whole wheat" "pita" "pancake" "pumpernickel" "olive loaf" | |
"nut loaf" "egg loaf" "sweet potato" "ice cream" "wheat gluten" | |
"banana" "sprouted grain"]) | |
(def toppings ["bleu cheese" "jalapeno" "olive" "maple syrup" "cucumber" | |
"chipotle" "onion" "mushroom" "swiss cheese" "cheddar cheese" | |
"pickle" "head cheese" "hot dog" "bratwurst" "mustard" "ketchup" | |
"gravy" "honey" "lemon" "sausage" "soysage" "cream cheese"]) | |
(def sides ["hash browns" "toast" "two eggs" "pancakes"]) | |
(def portion-size ["heaping helping" "side" "tiny serving" "deadly amount"]) | |
(def egg-options ["scramble" "omlet"]) | |
(defn rand-elt | |
[s] | |
(nth s (rand-int (count s)))) | |
(def bread (rand-elt breads)) | |
(def topping (set (for [x (range (rand-int (count toppings)))] | |
(rand-elt toppings)))) | |
(print "Content-type: text/plain\n\n") | |
(println "Today's Menu") | |
(println "-------------------") | |
(doseq [x (range 4)] | |
(let [bread (rand-elt breads) | |
toppings (set (for [x (range (inc (rand-int 5)))] | |
(rand-elt toppings))) | |
side (rand-elt sides)] | |
(println (re-gsub #"\s+" " " | |
(str (str "#" (inc x)) " " bread " " | |
(str (str-join ", " (take (dec (count toppings)) toppings)) | |
" and " (last toppings) " " (rand-elt egg-options)) | |
" with a " (rand-elt portion-size) " of " side))))) | |
(println "\nNO SUBSTITUTIONS!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment