Created
July 18, 2010 18:41
-
-
Save raek/480608 to your computer and use it in GitHub Desktop.
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
(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