Created
November 29, 2011 17:18
-
-
Save acardona/1405585 to your computer and use it in GitHub Desktop.
A minimal test to show a non-working (eval (read-string ...))
This file contains hidden or 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
(ns my.test | |
(:import [javax.swing JFrame JPanel JButton JLabel] | |
[java.awt Dimension] | |
[java.awt.event ActionListener])) | |
(defn parse | |
[^String s] | |
(println (eval (read-string s)))) | |
(let [^JLabel input (JLabel. "[255 255 255]")] | |
(doto (JFrame. "Test") | |
(.setContentPane | |
(doto (JPanel.) | |
(.add input) | |
(.add | |
(doto (JButton. "Parse") | |
(.addActionListener | |
(reify ActionListener | |
(actionPerformed [this event] (parse (.getText input))))))) | |
(.setPreferredSize (Dimension. 200 200)))) | |
(.pack) | |
(.setVisible true))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment