Re: breaking homoiconicity?
On Saturday, June 20, 2015 at 4:15:30 AM UTC+1, Sean Corfield wrote: (.getTypeName (Class/forName [Ljava.lang.String;)) ;;= java.lang.String[] — that is more readable! Thanks, that's helpful for me. By chance do you know if the class is natively recoverable from the TypeName for Clojure/Java? Class/forName can't roundtrip that string. I could implement a look-up table to translate between the two formats, but that seems rather kludgey. -- 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: breaking homoiconicity?
Thanks, that's helpful for me. By chance do you know if the class is natively recoverable from the TypeName for Clojure/Java? Class/forName can't roundtrip that string. I could implement a look-up table to translate between the two formats, but that seems rather kludgey. I actually just wrote a library for this sort of thing that works with any java.io.Serializable: https://bitbucket.org/morgon/jfreeze It's only meant to work with pr-dup (set the *print-dup* dynamic to true before printing), not necessarily the standard REPL printer, but generally if you're printing something you want to read back in you should be using pr-dup anyway. -- Morgon -- 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: breaking homoiconicity?
On Jun 20, 2015, at 3:58 AM, Joe Corneli holtzerman...@gmail.com wrote: On Saturday, June 20, 2015 at 4:15:30 AM UTC+1, Sean Corfield wrote: (.getTypeName (Class/forName [Ljava.lang.String;)) ;;= java.lang.String[] — that is more readable! Thanks, that's helpful for me. By chance do you know if the class is natively recoverable from the TypeName for Clojure/Java? Class/forName can't roundtrip that string. I’m not sure what you mean? The type of the array displays as [Ljava.lang.String; and when you do Class/forName on [Ljava.lang.String; you get back a Class that represents an array of String. The TypeName is just a human-readable form, not an actual Class name. Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
breaking homoiconicity?
This is an interaction with Clojure via CIDER. repl [1] (type (into-array String [Awesome])) [Ljava.lang.String; repl [2] [Ljava.lang.String; RuntimeException EOF while reading, starting at line 1 clojure.lang.Util.runtimeException (Util.java:221) repl [3] (quote [Ljava.lang.String;) CIDER won't let me enter [3] claiming that the input is not complete. What's going on here, apart from things not working? If [Ljava.lang.String; is a valid return value, and can show up in code that I construct programmatically, why is it not valid input? Is this a flaw in CIDER / lein, or are they giving me the right answers 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: breaking homoiconicity?
Most Java types don't have reversible serialisation in Clojure. There's actually only a small subset of data types that can be printed and then read without losing information. - James On 20 June 2015 at 01:08, Joe Corneli holtzerman...@gmail.com wrote: This is an interaction with Clojure via CIDER. repl [1] (type (into-array String [Awesome])) [Ljava.lang.String; repl [2] [Ljava.lang.String; RuntimeException EOF while reading, starting at line 1 clojure.lang.Util.runtimeException (Util.java:221) repl [3] (quote [Ljava.lang.String;) CIDER won't let me enter [3] claiming that the input is not complete. What's going on here, apart from things not working? If [Ljava.lang.String; is a valid return value, and can show up in code that I construct programmatically, why is it not valid input? Is this a flaw in CIDER / lein, or are they giving me the right answers 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: breaking homoiconicity?
On Jun 19, 2015, at 5:08 PM, Joe Corneli holtzerman...@gmail.com wrote: This is an interaction with Clojure via CIDER. repl [1] (type (into-array String [Awesome])) [Ljava.lang.String; This is a java.lang.Class object whose name is [Ljava.lang.String; because that’s how Java native arrays are encoded. CIDER won't let me enter [3] claiming that the input is not complete. What's going on here, apart from things not working? You can get the Class object like this: (Class/forName [Ljava.lang.String;) ;;= [Ljava.lang.String; — unhelpful but this is the name of the class, as above. and you can see what it really is like this: (.getTypeName (Class/forName [Ljava.lang.String;)) ;;= java.lang.String[] — that is more readable! Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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 --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.