Thou Impertinent Urchin-Faced Miscreant!
November 25, 2014
Our program takes a list of word lists and returns a list of words, one chosen randomly from each word list:
(define (buzz xss) (string-join #\space (map fortune xss)))
And here are some examples using the buzz-phrase generators on the previous page:
> (buzz broughton)
"integrated digital mobility"
> (buzz broughton)
"functional digital options"
> (buzz broughton)
"compatible policy concept"
> (buzz corporate)
"objectively cultivate cross-unit deliverables"
> (buzz corporate)
"proactively communicate fully researched markets"
> (buzz corporate)
"dynamically maintain user friendly infrastructures"
> (buzz shakespeare)
"Thou dissembling shard-borne baggage"
> (buzz shakespeare)
"Thou villainous crook-pated clack-dish"
> (buzz shakespeare)
"Thou unmuzzled toad-spotted maggot-pie"
We used string-join, fortune and the random number generator from the Standard Prelude. You can run the program at http://programmingpraxis.codepad.org/8bjUtPCW.
The real code is in the map line at the end – the rest is just loading in the definitions from the file using YAML, and then checking we have a valid key!
Haskell:
Only the code, put in whatever list of insults you fancy.