Re: Generate static methods at runtime?
gen-class can emit static methods, but one cannot leverage its functionality at runtime. But since compile-time is also a kind of runtime in Clojure, shouldnt't you be able to dynamically create an appropriate .clj file with the ns form and main- form, and have it compiled? -- -- 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/groups/opt_out.
Re: Cannot access a public static volatile field
On Sunday, March 17, 2013 6:02:07 AM UTC+1, vemv wrote: Ahhh I tracked it down - the class was not public. I thought .java files had to define at least (and at most) *one* public class/enum/interface. How much sense can it make to define a private class in its own file? :( It makes perfect sense: complecting access control with file organization is not exactly a plus for a language. The existing restriction of one public class per file is nuisance enough. Many times it forces the unwieldiness of nested classes upon you. -Marko -- -- 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/groups/opt_out.
Re: Generate static methods at runtime?
Yeah I guess it could work, did you have in mind something like programmatically running `lein compile`? Can the JVM handle .class files written on the fly? Anyway, for my particular problem I don't need runtime-compiled static methods anymore. On Sun, Mar 17, 2013 at 7:34 AM, Marko Topolnik marko.topol...@gmail.comwrote: gen-class can emit static methods, but one cannot leverage its functionality at runtime. But since compile-time is also a kind of runtime in Clojure, shouldnt't you be able to dynamically create an appropriate .clj file with the ns form and main- form, and have it compiled? -- -- 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 a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/Hu-oOlSccPc/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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/groups/opt_out.
Constructing java classes from a string containing the class name
I need the ability to create one of a number of java classes which have constructors taking a known list of parameters. There are a large enough number of classes that having a set of conditions testing for each class name would be unmanageable. The classes are from a third-party jar file so I cannot modify them either. The trouble is that new is special form and does not evaluate it's first parameter so if I write an expression like (new (Class/forName klassname) param1 param2) it fails because (Class/forName klassname) is treated as the class name rather than being evaluated first. The closest I've got so far is to write the following macro (defmacro make-proxy Build proxy class from name and map [klassname params] (list 'new (Class/forName klassname) '(:hostname params) '(:port params))) This gets me some of the way, I can now write (make-proxy com.example.foo {:hostname 127.0.0.1 :port 9559}) but it only works for constant strings since the first parameter is evaluated when the macro is expanded. Can anyone suggest a solution? thanks Dave -- -- 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/groups/opt_out.
Laziness in filter
Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io operations are executed once more than needed. As the operations are slow, one more round increases the overhead dramatically. Then I tested other pieces of code, such as: (first (filter #(when ( % 1) (println %) %) (range))) It prints out: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 and returns: 2 So why the lazy sequence is realized more than it is needed? Could I enforce the laziness and save unnecessary operation? Thanks, Bruce Li -- -- 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/groups/opt_out.
Re: Laziness in filter
I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote: Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io operations are executed once more than needed. As the operations are slow, one more round increases the overhead dramatically. Then I tested other pieces of code, such as: (first (filter #(when ( % 1) (println %) %) (range))) It prints out: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 and returns: 2 So why the lazy sequence is realized more than it is needed? Could I enforce the laziness and save unnecessary operation? Thanks, Bruce Li -- -- 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/groups/opt_out.
Re: Imported Java lib can't find classes compiled on the fly
You can make the clojure class loader by yourself: (import '(clojure.lang RT)) (def class-loader (RT/makeClassLoader)) user= (.loadClass class-loader user.Foo) user.Foo 2013/3/17 vemv v...@vemv.net Most definitely :) But that something is hard/confusing should'nt be enough reason to give up. On Sunday, March 17, 2013 4:11:34 AM UTC+1, James Xu wrote: Then things will get complicated and ugly. 原始邮件 *发件人:* Víctor M. Valenzuelave...@vemv.net *收件人:* clojureclo...@**googlegroups.com *发送时间:* 2013年3月17日(周日) 11:05 *主题:* Re: Imported Java lib can't find classes compiled on the fly My guess is it was set via Thread.currentThread().** setContextClassLoader()...? On Sun, Mar 17, 2013 at 3:07 AM, Víctor M. Valenzuela ve...@vemv.netwrote: Yeah I was working in that direction now! Anyway, how come (Class/forName) can work if used from the repl? My understanding is that the classloader provided by Class is different from DynamicClassLoader. On Sun, Mar 17, 2013 at 3:01 AM, Michael Klishin michael@gmail.comwrote: 2013/3/17 vemv ve...@vemv.net I guess that somehow the Java library uses a different classloader or something like that? Any possible solution? Clojure itself uses a separate classloader: a clojure.lang.**DynamicClassLoader instance. If you can use an instance of that classloader, you should be fine. -- MK http://github.com/**michaelklishin http://github.com/michaelklishin http://twitter.com/**michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/clojure/-n3jul1IeZ8/**unsubscribe?hl=enhttps://groups.google.com/d/topic/clojure/-n3jul1IeZ8/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to clojure+u...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://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+u...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- -- 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/groups/opt_out. -- 庄晓丹 Email:killme2...@gmail.com xzhu...@avos.com Site: http://fnil.net Twitter: @killme2008 -- -- 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/groups/opt_out.
Re: Generate static methods at runtime?
On Sunday, March 17, 2013 8:31:24 AM UTC+1, vemv wrote: Yeah I guess it could work, did you have in mind something like programmatically running `lein compile`? Yes, just about, but even simpler: you just call *compile*, *load, load-file * or similar while binding *compile-files* to true (*compile* does that itself, others leave you the choice). Can the JVM handle .class files written on the fly? Yes, the JVM can load a .class file at any time, and in fact it does so in the routine operation. *Unloading* a class is not as simple, though. -- -- 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/groups/opt_out.
Re: Laziness in filter
Yep,it's chunked sequence,just like batch processing. You can use the seq1 function in fogus blog. 2013/3/17 Evan Mezeske emeze...@gmail.com I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote: Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io operations are executed once more than needed. As the operations are slow, one more round increases the overhead dramatically. Then I tested other pieces of code, such as: (first (filter #(when ( % 1) (println %) %) (range))) It prints out: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 and returns: 2 So why the lazy sequence is realized more than it is needed? Could I enforce the laziness and save unnecessary operation? Thanks, Bruce Li -- -- 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/groups/opt_out. -- 庄晓丹 Email:killme2...@gmail.com xzhu...@avos.com Site: http://fnil.net Twitter: @killme2008 -- -- 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/groups/opt_out.
Re: Laziness in filter
This is one of the most frequenly-asked questions and a source of surprise to practically every new Clojure user. An update to the official documentation on lazy sequences would surely help a lot here. -marko On Sunday, March 17, 2013 9:18:05 AM UTC+1, Evan Mezeske wrote: I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ . On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote: Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io operations are executed once more than needed. As the operations are slow, one more round increases the overhead dramatically. Then I tested other pieces of code, such as: (first (filter #(when ( % 1) (println %) %) (range))) It prints out: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 and returns: 2 So why the lazy sequence is realized more than it is needed? Could I enforce the laziness and save unnecessary operation? Thanks, Bruce Li -- -- 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/groups/opt_out.
Re: Imported Java lib can't find classes compiled on the fly
No built-in Java mechanism (such as Class/forName) relies on the context classloader, that's just a mechanism that was supposed to help other frameworks manage class loading. Every such framework would have to explicitly getContextClassLoader to use it. On Sunday, March 17, 2013 4:05:51 AM UTC+1, vemv wrote: My guess is it was set via Thread.currentThread().setContextClassLoader()...? On Sun, Mar 17, 2013 at 3:07 AM, Víctor M. Valenzuela ve...@vemv.netjavascript: wrote: Yeah I was working in that direction now! Anyway, how come (Class/forName) can work if used from the repl? My understanding is that the classloader provided by Class is different from DynamicClassLoader. On Sun, Mar 17, 2013 at 3:01 AM, Michael Klishin michael@gmail.comjavascript: wrote: 2013/3/17 vemv ve...@vemv.net javascript: I guess that somehow the Java library uses a different classloader or something like that? Any possible solution? Clojure itself uses a separate classloader: a clojure.lang.DynamicClassLoader instance. If you can use an instance of that classloader, you should be fine. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/-n3jul1IeZ8/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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/groups/opt_out.
Re: Constructing java classes from a string containing the class name
Great! Many thanks. Dave On Sunday, 17 March 2013 08:18:27 UTC, dennis wrote: Sorry,it's getDeclaredConstructor: (- klassname (Class/forName) (. getDeclaredConstructor String int) (.newInstance host port)) 2013/3/17 dennis zhuang killm...@gmail.com javascript: You can get the constructor and instance it: (- klassname (Class/forName) (.getDeclaredConstructors String int) (.newInstance host port)) 2013/3/17 Dave Snowdon dave.s...@gmail.com javascript: I need the ability to create one of a number of java classes which have constructors taking a known list of parameters. There are a large enough number of classes that having a set of conditions testing for each class name would be unmanageable. The classes are from a third-party jar file so I cannot modify them either. The trouble is that new is special form and does not evaluate it's first parameter so if I write an expression like (new (Class/forName klassname) param1 param2) it fails because (Class/forName klassname) is treated as the class name rather than being evaluated first. The closest I've got so far is to write the following macro (defmacro make-proxy Build proxy class from name and map [klassname params] (list 'new (Class/forName klassname) '(:hostname params) '(:port params))) This gets me some of the way, I can now write (make-proxy com.example.foo {:hostname 127.0.0.1 :port 9559}) but it only works for constant strings since the first parameter is evaluated when the macro is expanded. Can anyone suggest a solution? thanks Dave -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: 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+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 庄晓丹 Email:killm...@gmail.com javascript: xzh...@avos.comjavascript: Site: http://fnil.net Twitter: @killme2008 -- 庄晓丹 Email:killm...@gmail.com javascript: xzh...@avos.comjavascript: Site: http://fnil.net Twitter: @killme2008 -- -- 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/groups/opt_out.
Re: Laziness in filter
Ah, it works. It is really chunked sequences. Thanks. Having been using clojure for half a year, it keeps really bringing me surprise and fun :) 2013/3/17 Marko Topolnik marko.topol...@gmail.com This is one of the most frequenly-asked questions and a source of surprise to practically every new Clojure user. An update to the official documentation on lazy sequences would surely help a lot here. -marko On Sunday, March 17, 2013 9:18:05 AM UTC+1, Evan Mezeske wrote: I'd guess that what you're seeing is related to chunked sequences: http://blog.fogus.**me/2010/01/22/de-chunkifying-**sequences-in-clojure/http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/. On Sunday, March 17, 2013 1:12:17 AM UTC-7, bruce li wrote: Hello, everyone. I'm writing some code that utilizes the lazy sequence. But I found something strange. Here is how: The code is like: (first (filter some-expensive-io urls)) The code is aimed to find the first result of the operations on the urls that is not nil. However, it seems that the io operations are executed once more than needed. As the operations are slow, one more round increases the overhead dramatically. Then I tested other pieces of code, such as: (first (filter #(when ( % 1) (println %) %) (range))) It prints out: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 and returns: 2 So why the lazy sequence is realized more than it is needed? Could I enforce the laziness and save unnecessary operation? Thanks, Bruce Li -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Imported Java lib can't find classes compiled on the fly
There's the alternative signature Class.forName(String, boolean, ClassLoader). I got the Java side to use that instead of a plain Class.forName, passing it a custom ClassLoader (see my immediately previous reply). On Sun, Mar 17, 2013 at 12:38 PM, Marko Topolnik marko.topol...@gmail.comwrote: No built-in Java mechanism (such as Class/forName) relies on the context classloader, that's just a mechanism that was supposed to help other frameworks manage class loading. Every such framework would have to explicitly getContextClassLoader to use it. On Sunday, March 17, 2013 4:05:51 AM UTC+1, vemv wrote: My guess is it was set via Thread.currentThread().** setContextClassLoader()...? On Sun, Mar 17, 2013 at 3:07 AM, Víctor M. Valenzuela ve...@vemv.netwrote: Yeah I was working in that direction now! Anyway, how come (Class/forName) can work if used from the repl? My understanding is that the classloader provided by Class is different from DynamicClassLoader. On Sun, Mar 17, 2013 at 3:01 AM, Michael Klishin michael@gmail.comwrote: 2013/3/17 vemv ve...@vemv.net I guess that somehow the Java library uses a different classloader or something like that? Any possible solution? Clojure itself uses a separate classloader: a clojure.lang.**DynamicClassLoader instance. If you can use an instance of that classloader, you should be fine. -- MK http://github.com/**michaelklishin http://github.com/michaelklishin http://twitter.com/**michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@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+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/** topic/clojure/-n3jul1IeZ8/**unsubscribe?hl=enhttps://groups.google.com/d/topic/clojure/-n3jul1IeZ8/unsubscribe?hl=en . To unsubscribe from this group and all its topics, send an email to clojure+u...@**googlegroups.com. For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out . -- -- 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 a topic in the Google Groups Clojure group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/-n3jul1IeZ8/unsubscribe?hl=en. To unsubscribe from this group and all its topics, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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/groups/opt_out.
Can I get a string like :cities as a keyword without getting the double ::?
I have been doing stuff like (str type-as-keyword) to push values into HTML forms, which leaves me with a string like :cities when the HTML forms are submitted. I might fetch them like: (let [this-item (get-in request [:params answers])) If I then do: this-item-as-keyword (keyword this-item) I get a value like: ::cities but I do not want the double colons. I find myself doing awkward things like: (st/replace (str (:name item)) #: ) to remove the colon from the string before I transform the string into a keyword. I assume there must be a more elegant way to do this? (Someone might be tempted to say that I should not put the keywords into HTML forms, but that doesn't solve the problem, as I then have to call (st/replace) before I put the value in the form, rather than when I receive the form input -- in other words, that solution changes when I have to remove the colon, but does not fix the problem.) -- -- 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/groups/opt_out.
Re: Can I get a string like :cities as a keyword without getting the double ::?
On 17/03/13 18:42, larry google groups wrote: (st/replace (str (:name item)) #: ) #(apply str (next %)) Jim -- -- 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/groups/opt_out.
Re: Can I get a string like :cities as a keyword without getting the double ::?
Use read-string. user (read-string :cities) :cities On Sunday, 17 March 2013 14:42:38 UTC-4, larry google groups wrote: I have been doing stuff like (str type-as-keyword) to push values into HTML forms, which leaves me with a string like :cities when the HTML forms are submitted. I might fetch them like: (let [this-item (get-in request [:params answers])) If I then do: this-item-as-keyword (keyword this-item) I get a value like: ::cities but I do not want the double colons. I find myself doing awkward things like: (st/replace (str (:name item)) #: ) to remove the colon from the string before I transform the string into a keyword. I assume there must be a more elegant way to do this? (Someone might be tempted to say that I should not put the keywords into HTML forms, but that doesn't solve the problem, as I then have to call (st/replace) before I put the value in the form, rather than when I receive the form input -- in other words, that solution changes when I have to remove the colon, but does not fix the problem.) -- -- 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/groups/opt_out.
Re: Can I get a string like :cities as a keyword without getting the double ::?
aaa of course, if you do want to *read* the keyword in, use read-string...there is no point in getting rid of the ':' and then essentially re-inserting it! Jim On 17/03/13 18:51, JvJ wrote: Use read-string. user (read-string :cities) :cities On Sunday, 17 March 2013 14:42:38 UTC-4, larry google groups wrote: I have been doing stuff like (str type-as-keyword) to push values into HTML forms, which leaves me with a string like :cities when the HTML forms are submitted. I might fetch them like: (let [this-item (get-in request [:params answers])) If I then do: this-item-as-keyword (keyword this-item) I get a value like: ::cities but I do not want the double colons. I find myself doing awkward things like: (st/replace (str (:name item)) #: ) to remove the colon from the string before I transform the string into a keyword. I assume there must be a more elegant way to do this? (Someone might be tempted to say that I should not put the keywords into HTML forms, but that doesn't solve the problem, as I then have to call (st/replace) before I put the value in the form, rather than when I receive the form input -- in other words, that solution changes when I have to remove the colon, but does not fix the problem.) -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
Re: Can I get a string like :cities as a keyword without getting the double ::?
2013/3/17 JvJ kfjwhee...@gmail.com Use read-string. user (read-string :cities) :cities And if the input may be coming from untrusted sources, please use clojure.edn/read-string (Clojure 1.5+). -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- 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/groups/opt_out.
ANN: core.logic 0.8.0
I'm happy to announce the release of core.logic 0.8.0. There are far too changes, bug fixes, and enhancements to cover here. For the most part the miniKanren portion of core.logic has been left unchanged from the standpoint of the user. The biggest change is the inclusion of extensible constraint logic programming (CLP) - specifically we now support constraint logic programming over finite domains as well as nominal logic programming. It's been a long time since the last release, getting all the CLP bits working has been a quite a job, but moving forward releases should be considerably more incremental. https://github.com/clojure/core.logic Happy relational hacking! David -- -- 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/groups/opt_out.
Re: FYI - Light Rail notes for Portland (fix)
On Mar 16, 2013, at 9:24 PM, Rich Morin r...@cfcl.com wrote: The cost of a taxi from Portland Intl. Airport (PDX) to the Clojure/West hotel (Courtyard by Marriott) is listed (by the hotel) as about $35 one way. To save money, you can take the (TriMet) light rail: * Walk to the Portland Intl. MAX station (Red Line). * Take MAX to the Gateway/NE 99th Ave TC MAX Station. * Board MAX Green Line to City Center/PSU. * Get off at SW 5th Oak St MAX Station. * Walk (~1/2 blk.) west to 550 SW Oak St. * The fare is $2.50 for adults, $1 for seniors (65+). Rich: Thanks for pointing this out. $2.50 is definitely much more appealing than $35! I just tried the Trip Planner on the TriMet site and it shows that a trip from the airport to 550 SW Oak Street in Portland can be done on the red line alone. http://tinyurl.com/b2w43or Does that look right to anybody who might be more familiar with the area? It looks like a longer walk to the hotel from the station, but still only 0.3 miles. I'd prefer a longer walk to making a transfer on a light rail system that I'm not familiar with. Thanks! Charlie -- Charlie Griefer http://charlie.griefer.com Give light, and the darkness will disappear of itself. -- Desiderius Erasmus -- -- 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/groups/opt_out.
Re: [ClojureScript] Re: Moving ClojureScript to Clojure 1.5.0 data.json dependency
Done! On Sun, Mar 17, 2013 at 4:49 PM, Darrick Wiebe d...@xnlogic.com wrote: On Friday, 1 March 2013 11:41:26 UTC-8, David Nolen wrote: Now that Clojure 1.5.0 is out the door I'd like to make ClojureScript depend on it. This would allow me to merge in the source map branch which is a work in progress but far enough along that the critical bits are there and it would be nice to get community contributions towards wrapping it up. Merging in the source map work would require adding data.json as a dependency. Anyone have issues with these changes? David +1 -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescr...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript?hl=en. -- -- 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/groups/opt_out.
Re: clojure.core/format localization problems
I'm having this problem again. I start the repl with nrepl-jack-in. Also starting it on the command line with 'lein repl' shows the same problem. What is causing the JVM to lose the default locale settings (at least in regard to number formatting)? Thanks. On Sunday, March 10, 2013 12:39:57 AM UTC, dabd wrote: On my system I have: *clojure-version* {:major 1, :minor 4, :incremental 0, :qualifier nil} (java.util.Locale/getDefault) #Locale en_US (format %.1f 0.5) 0,5 (java.lang.String/format (java.util.Locale/getDefault) %.1f (to-array [0.5])) 0.5 but (java.lang.String/format %.1f (to-array [0.5])) 0,5 How can I set clojure.core/format to display numbers with a dot decimal separator? Why calling java.lang.String/format with the default locale returns a different value than calling it without specifying the locale (javadoc says it uses the default locale so they should return the same value)? Thanks. -- -- 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/groups/opt_out.
Re: Can I get a string like :cities as a keyword without getting the double ::?
Thanks all. read-string seems obvious now that you all suggest it. On Sunday, March 17, 2013 3:01:14 PM UTC-4, Michael Klishin wrote: 2013/3/17 JvJ kfjwh...@gmail.com javascript: Use read-string. user (read-string :cities) :cities And if the input may be coming from untrusted sources, please use clojure.edn/read-string (Clojure 1.5+). -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- 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/groups/opt_out.
Re: clojure.core/format localization problems
It seems like 1.7 changed how default Locales are read from the host: http://stackoverflow.com/questions/7107972/java-7-default-locale http://blog.ej-technologies.com/2011/12/default-locale-changes-in-java-7.html On Sunday, March 17, 2013 10:40:19 PM UTC, dabd wrote: I'm having this problem again. I start the repl with nrepl-jack-in. Also starting it on the command line with 'lein repl' shows the same problem. What is causing the JVM to lose the default locale settings (at least in regard to number formatting)? Thanks. On Sunday, March 10, 2013 12:39:57 AM UTC, dabd wrote: On my system I have: *clojure-version* {:major 1, :minor 4, :incremental 0, :qualifier nil} (java.util.Locale/getDefault) #Locale en_US (format %.1f 0.5) 0,5 (java.lang.String/format (java.util.Locale/getDefault) %.1f (to-array [0.5])) 0.5 but (java.lang.String/format %.1f (to-array [0.5])) 0,5 How can I set clojure.core/format to display numbers with a dot decimal separator? Why calling java.lang.String/format with the default locale returns a different value than calling it without specifying the locale (javadoc says it uses the default locale so they should return the same value)? Thanks. -- -- 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/groups/opt_out.
Re: Raw strings
Python has a notation for raw strings Python also has multiple inheritance :) what I want to mean is that some features have dubious value, regardless of whether they made it to language X or Y. I'm working on a project right now where the lack of raw strings is killing me. Do you absolutely need to interleave code and data? Can't you e.g. store the strings in separate files, and keep references to those strings in your code (i18n style)?. There's also the possibility of using selector-based transformations, a la Enlive. Given the new work on edn and clojure.tools.reader, I'm hoping that the reader technology is now at a point where adding raw strings would be a trivial endeavor, thus tipping the value:complexity ratio of adding raw strings in favor of doing it. Reading a raw string stored in a file is already trivial :) One of Clojure's value propositions is that it is good for making DSLs. I don't remember a statement like that from the clojure.org texts or Rich's talks. Admittedly, Paul Graham's essays (which are all about DSLs) brought me (and many) to the Clojure world but it's easy to perceive that those values aren't *particularly* promoted by the language's design or Rich's discourse. The reality is that Clojure is mostly only good for writing DSLs that use Clojure's syntax. I belive that data is the ultimate DSL anyway - it allows one to express arbitrarily specific information in an extensible way. Interleaving code and data (as some languages' DSL facilities foster) is inherently complex (and limited). Sometimes a string-based DSL is exactly what you need to achieve the desired clarity. Nothing stops you from using/writing a parser for an alternative/custom syntax. Just don't mix that DSL with Clojure (in the same way that one doesn't mix server code, HTML, JS, SQL, all in the same files). -- -- 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/groups/opt_out.
Re: ANN: core.logic 0.8.0
Hot on the heels of 0.8.0, 0.8.1! This is mostly to push out some nice catches from Jonas Enlund (who works on the Clojure linter Kibit). One cool addition is that featurec is now recursive so you can constrain extract features of out nested maps with ease. http://github.com/clojure/core.logic/blob/master/CHANGES.md On Sun, Mar 17, 2013 at 2:50 PM, David Nolen dnolen.li...@gmail.com wrote: I'm happy to announce the release of core.logic 0.8.0. There are far too changes, bug fixes, and enhancements to cover here. For the most part the miniKanren portion of core.logic has been left unchanged from the standpoint of the user. The biggest change is the inclusion of extensible constraint logic programming (CLP) - specifically we now support constraint logic programming over finite domains as well as nominal logic programming. It's been a long time since the last release, getting all the CLP bits working has been a quite a job, but moving forward releases should be considerably more incremental. https://github.com/clojure/core.logic Happy relational hacking! David -- -- 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/groups/opt_out.
Re: ANN: core.logic 0.8.0
This is epic, and a long time coming! Thanks for the hard work David and congrats to the other contributors, especially Nada and Jonas! Thanks, Ambrose On Mon, Mar 18, 2013 at 3:50 AM, David Nolen dnolen.li...@gmail.com wrote: I'm happy to announce the release of core.logic 0.8.0. There are far too changes, bug fixes, and enhancements to cover here. For the most part the miniKanren portion of core.logic has been left unchanged from the standpoint of the user. The biggest change is the inclusion of extensible constraint logic programming (CLP) - specifically we now support constraint logic programming over finite domains as well as nominal logic programming. It's been a long time since the last release, getting all the CLP bits working has been a quite a job, but moving forward releases should be considerably more incremental. https://github.com/clojure/core.logic Happy relational hacking! David -- -- 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/groups/opt_out. -- -- 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/groups/opt_out.
[ANN] Termito - a term rewriting library
Hi I'm happy to announce the first release of termito[1]. Termito is a term rewriting library inspired by the kibit rule system. With termito you can write declarative term rewriting rules like (defrules zero-rules [(* 0 ?x) 0]) (defrules identity-rules [(* 1 ?x) ?x] [(+ 0 ?x) ?x]) (def rules (concat zero-rules identity-rules) and ask the library to simplify expressions for you: (simplify '(+ (* 0 x) (* 1 y) rules) ;; = y Feedback, usage and bug reports welcome! Jonas [1] https://github.com/jonase/termito -- -- 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/groups/opt_out.
Re: Raw strings
On Sun, Mar 17, 2013 at 6:07 PM, vemv v...@vemv.net wrote: Reading a raw string stored in a file is already trivial :) I'm aware that one can store a raw string in a file. But in many instances, this would be absurd. For the kind of rapid interactive development we have in Clojure, we don't necessarily want every single SQL query in a separate file. Similarly, nobody wants to store every regexp in a separate file. Actually, regexps are a great example, because the Clojure reader handles them specially so they don't have to deal quite as much with escaping as if they were ordinary strings. I just want that kind of capability for my own library. I belive that data is the ultimate DSL anyway - it allows one to express arbitrarily specific information in an extensible way. Interleaving code and data (as some languages' DSL facilities foster) is inherently complex (and limited). Clojure's edn format is convenient for many things, but it has its own set of limitations and there's nothing ultimate about it. I don't see anyone proposing that regexps should be replaced by a Clojure-data DSL. Some DSLs are based on a really handy notation that has been in use by computer scientists and/or mathematicians for decades or longer. Trying to shoe-horn these convenient notations into something that looks like Clojure is not always the right way to go. -- -- 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/groups/opt_out.