Skip to content

Instantly share code, notes, and snippets.

@samth
Forked from jorendorff/ideagen.py
Last active December 14, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samth/5016438 to your computer and use it in GitHub Desktop.
Save samth/5016438 to your computer and use it in GitHub Desktop.
Talk ideas in Racket
#lang at-exp racket
;; Generate lovely ideas for talks
;; Ported from Jason Orendorff's python code:
;; https://gist.github.com/jorendorff/4659406
(require math)
(define productions
#hash(["tech" . ("HTML5"
"Audio"
"CoffeeScript"
"Twig"
"jQuery"
"memcached"
"Mashups"
"Backbone.js"
"Bootstrap"
"Lisp"
"CSS3"
"git"
"Clojure"
"Haskell"
"Monads")]
["other" . ["bacon"
"chocolate"
"Befunge"
"Autotune"
"dubstep"]]
("person" . ["goths"
"dogs"
"zombies"])
; pp = preposition phrase
("pp" . ["in 140 characters"
"in small pieces"
"on a Raspberry Pi"
"for great justice"
"FTW"])
("talk" . ["${tech} for ${person}"
"${tech} + ${tech} = awesome"
"${tech} with ${other}"
"${tech} and ${other}"
"${tech} ${pp}"
"How to use ${tech} to make an amazing mess"])))
;; choose a random element of l
(define (choose l) (sample (discrete-dist l)))
(define (randomly-generated nt)
(regexp-replace* @pregexp|{\$\{(\w+)\}}|
(choose (hash-ref productions nt))
(λ (_ m) (randomly-generated m))))
(define (random-idea)
(randomly-generated "talk"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment