Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(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
You can’t perform that action at this time.