Re: Looking for an idiom regarding type hints
Thanks, I didn't realize type hints could be used on superclasses, I guess this will work in general since functions that only differ by type hints probably will inherit from the same thing in just about every case. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Deserialization of a Record
As an update to this, I can get deserialization working, so long as I (compile 'babel.records) within the file itself. It seems to me that having a raw (compile 'babel.records) type form at the start of each namespace containing defrecords I need to serialize would not be ideal, are there general recommendations for doing this kind of thing? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Deserialization of a Record
I have a problem deserializing a record from within a swing application. I wrote the minimal amount of code required to highlight the problem i'm having below. (if unfamiliar with seesaw, this is just creating a JButton which deserializes the record in the file "/tmp/point" on-click) (ns babel.records (:require (seesaw (core :refer (alert frame button listen)) (mig :refer (mig-panel) (defrecord Point [x y]) (comment "Serialization and deserialization from a REPL works fine." (spit "/tmp/point" (binding [*print-dup* true] (pr-str (->Point 1 2 "/tmp/point" => #babel.records.Point[1, 2] (read-string (slurp "/tmp/point")) => #babel.records.Point{:x 1, :y 2} ) (defn framework [] (let [b (button :text "Deserialize")] (listen b :action (fn [e] (alert (read-string (slurp "/tmp/point") (frame :content (mig-panel :constraints ["" "" ""] :items [[b]]) :size [323 :by 200] :visible? true))) ;; Clicking the button throws the following error: ;; Exception in thread "AWT-EventQueue-0" java.security.PrivilegedActionException: java.security.PrivilegedActionException: java.lang.ClassNotFoundException: babel.records.Point It looks to me that the class/record can't be seen from the EDT, is there a solution here? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Alternate set literal syntax?
I don't mind the #{} syntax, however I feel that if alternate syntax were to be introduced (for whatever datatype) it should be the unicode parenthesis since they 1. Look nice, 2. No addition of extra characters (I value succinctness), 3. They work in most common existing structured editing environments- emacs/paredit supports unicode parens right now, whereas a construct like {{}} would break down pretty fast. The downside (however minor) is the user has to remap some key-binding to support it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
(flatten )
Hi there, possibly the flatten documentation is wrong as (flatten nil) for me is returning the empty list rather than nil. (1.3.0). Is there a better place to post this? (clojure.core/flatten nil) => () from docstring: "Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns nil." -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en