Skip to content

Instantly share code, notes, and snippets.

@raek
Created July 18, 2010 18:41
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 raek/480608 to your computer and use it in GitHub Desktop.
Save raek/480608 to your computer and use it in GitHub Desktop.
(import 'javax.swing.JOptionPane)
(defn ask
"Ask the user a question. Returns nil if the user aborts."
[title question]
(JOptionPane/showInputDialog nil question title
JOptionPane/QUESTION_MESSAGE))
(defn ask-the-user-seq []
(lazy-seq
(when-let [answer (ask "Your computer wonders"
"What is the next element of the sequence?")]
(cons answer (ask-the-user-seq)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment