Created
January 3, 2011 09:04
-
-
Save afeinberg/763280 to your computer and use it in GitHub Desktop.
Thomas Friedman AI
This file contains 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
(ns friedman) | |
;; Inspired by ``A Grammar for a Subset of English'', PAIP by Norvig pp. 35-36 | |
(defn one-of [lst] | |
(nth lst (rand-int (count lst)))) | |
(defn common-occupation [] | |
(one-of '("barber" "cab driver" "teacher" "fisherman" "doctor"))) | |
(defn capital-of-developing-country [] | |
(one-of '("Lagos" "Minsk" "Kuala Lumpur" "Cairo" "Caracas"))) | |
(defn anecdote [] | |
(one-of '("about how they bought apples from Spain via a cell-phone" | |
"that the playing field is level" | |
"there are unemployed bankers"))) | |
(defn unsupported-conclusion [] | |
(one-of '("the world is flat." "the sky is green." "the moon is made of cheese."))) | |
(defn friedman [] | |
(str "One " (common-occupation) " in " (capital-of-developing-country) | |
" told me " (anecdote) ", then I realized " (unsupported-conclusion))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment