Clojurescript libraries for MVC and state management
Hi, Are there any clojurescript libraries / frameworks for mvc, or state management ? I have come across clojurescript one and waltz. Thanks, Murtaza -- 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: Clojurescript libraries for MVC and state management
Probably a canonical catalog of Clojure libraries with corresponding description, project URL and Lein dependency coordinates would be nice to have. One list here: http://clojure-libraries.appspot.com/ but not sure if it has info on CLJS libs. Shantanu On May 17, 6:37 am, Murtaza Husain murtaza.hus...@sevenolives.com wrote: Hi, Are there any clojurescript libraries / frameworks for mvc, or state management ? I have come across clojurescript one and waltz. Thanks, Murtaza -- 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: Clojure Bee iPhone app updated
Any android port in the pipeline? -- 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: Clojure Bee iPhone app updated
Looks interesting. Does it work off-line with local docs or require an Internet connection? BTW, do you know any Web Repl working on an iPhone or iPad? I tryied: - http://tryclj.com/ (well, it works but does not support a copy/past action) - http://lotrepls.appspot.com/ (it requires a submit via CTRL+ENTER, but the iPad does not have a CTRL button :) ) Thanks Rob On Thu, May 17, 2012 at 2:45 AM, mudphone kyle...@gmail.com wrote: Just a quick announcement that the Clojure Bee iPhone app was just updated. This release eliminates crashiness and updates the font for the source code view. More info on the app here: http://itunes.apple.com/us/app/clojure-bee-api-documentation/id524862532?ls=1mt=8 Anyone interested in a free copy, please email me directly (it's $1). I'm more than happy to give free copies to the Clojure community. Thanks! Kyle PS - It's called Clojure *Bee* because there is a quiz component, yet to be released (coming soon!). -- 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 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
core.logic, goals and facts
I'm taking a more serious dive into logic programming and I have a question about facts. *Is it true that that goals and facts are the same in that you can use unification and conde to get the same effect? So querying a conde of multiple unifications is like stating a bunch of facts of a relation, and then querying that relation?* * * *Also then if this is true, is it also true that the reason we have facts is that they can be indexed and thus be more efficient?* * * * * -- 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: core.logic, goals and facts
On Thu, May 17, 2012 at 7:19 PM, Brent Millare brent.mill...@gmail.comwrote: I'm taking a more serious dive into logic programming and I have a question about facts. *Is it true that that goals and facts are the same in that you can use unification and conde to get the same effect? So querying a conde of multiple unifications is like stating a bunch of facts of a relation, and then querying that relation?* That's how I conceptualise it. I think the similarities between the two are pretty cool :) * * *Also then if this is true, is it also true that the reason we have facts is that they can be indexed and thus be more efficient?* Facts are also a convenient way of incrementally adding to a relation, but certainly IMO their primary purpose in core.logic is efficiency. Thanks, Ambrose -- 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: Clojure Bee iPhone app updated
I only have plans to build it out on iOS. Sorry. On Wednesday, May 16, 2012 11:32:07 PM UTC-10, Nicolas Oury wrote: Any android port in the pipeline? -- 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: Clojure Bee iPhone app updated
It works offline. Metadata is slurped up for all the libraries and packed into the app. So, at the moment, no Internet connection required. On Wednesday, May 16, 2012 11:53:03 PM UTC-10, robermann79 wrote: Looks interesting. Does it work off-line with local docs or require an Internet connection? BTW, do you know any Web Repl working on an iPhone or iPad? I tryied: - http://tryclj.com/ (well, it works but does not support a copy/past action) - http://lotrepls.appspot.com/ (it requires a submit via CTRL+ENTER, but the iPad does not have a CTRL button :) ) Thanks Rob On Thu, May 17, 2012 at 2:45 AM, mudphone wrote: Just a quick announcement that the Clojure Bee iPhone app was just updated. This release eliminates crashiness and updates the font for the source code view. More info on the app here: http://itunes.apple.com/us/app/clojure-bee-api-documentation/id524862532?ls=1mt=8 Anyone interested in a free copy, please email me directly (it's $1). I'm more than happy to give free copies to the Clojure community. Thanks! Kyle PS - It's called Clojure *Bee* because there is a quiz component, yet to be released (coming soon!). -- 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 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: Idiomatic usage of partial
On Wed, May 16, 2012 at 1:57 PM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: What is the idiomatic use of partial. I understand it helps create closures, however the reader notation also allows to the same. So when should partial be use dover other forms of creating functions. I have no idea if it is idiomatic or not but I've come to use partial whenever I want to use a function with the leading arguments fixed. The only times I use the `#` reader macro is when I need to fix an argument that's after the argument I want to map over or utilize. I find partial to signal my intent better in the cases where I'm trying to say give me a new function with leading arguments fixed vs. the reader macro which doesn't really signal my intent at all other than that I want an anonymous function that may do anything at all. Also partial clearly indicates that I'm doing a higher-order operation on an existing function which could lead to less cognitive overload, I suppose, when reading the code later on whereas the reader macro sort of has to be read thoroughly in order to understand what I was trying to do. Just my 2 cents. -- 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: Idiomatic usage of partial
On Wed, May 16, 2012 at 1:57 PM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: What is the idiomatic use of partial. I understand it helps create closures, however the reader notation also allows to the same. So when should partial be use dover other forms of creating functions. Also, for the sake of spamming of group (^_^), I find that many of the times I've elected to use `#` to define a truly anonymous function, as in a function that isn't building on something else, per se, but is just being used in the local context to do something specific, I almost always end up pulling it out later at least into a let-fn form if not into a top level form. It's a little like leaving the `{}` off of a one line if statement. It saves a little typing, but over the long haul it almost always seems to come back to bite you. -- 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: Assuring avalaibility of ring web apps
On Wed, May 16, 2012 at 3:13 AM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: Is there a lein plugin which can monitor and restart the app if it is down ( such as nodejs's forever) ? I just noticed this part of your question. In your context (EC2) it should be exceedingly simple do write a bash script that would do this. Use curl or wget or something to retrieve the landing page, and if it responds with an error code cd into the directory and run your start up command. Throw that in cron and you should be good to go. Of course pingdom or the other services mentioned here could still be useful to actually notify you when it has gone down. -- 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: Clojure Bee iPhone app updated
Hello, It looks quite nice. Im hoping for an Android version though Leo Noordhuizen On Thu, May 17, 2012 at 11:53 AM, Roberto Mannai roberm...@gmail.comwrote: Looks interesting. Does it work off-line with local docs or require an Internet connection? BTW, do you know any Web Repl working on an iPhone or iPad? I tryied: - http://tryclj.com/ (well, it works but does not support a copy/past action) - http://lotrepls.appspot.com/ (it requires a submit via CTRL+ENTER, but the iPad does not have a CTRL button :) ) Thanks Rob On Thu, May 17, 2012 at 2:45 AM, mudphone kyle...@gmail.com wrote: Just a quick announcement that the Clojure Bee iPhone app was just updated. This release eliminates crashiness and updates the font for the source code view. More info on the app here: http://itunes.apple.com/us/app/clojure-bee-api-documentation/id524862532?ls=1mt=8 Anyone interested in a free copy, please email me directly (it's $1). I'm more than happy to give free copies to the Clojure community. Thanks! Kyle PS - It's called Clojure *Bee* because there is a quiz component, yet to be released (coming soon!). -- 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 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 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
Avoid duplicate computation in commute?
Hi, The duplicate computation in commute seems to me quite a blemish on clojure's beauty. I even see somebody's code with comments pre- compute x because otherwise commute will call it twice. So I need to keep that fact in the back of my mind when using it? That is not what I was hoping for. I found this post where somebody else seems to be bothered enough to raise the same question: http://groups.google.com/group/clojure/browse_thread/thread/8b4560096018cd1f/bb2f9b05930a12de?lnk=gstq=commute%2C+twice#bb2f9b05930a12de Can we do the computation twice *only* when at the commit time the ref was actually changed in another thread? 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
Re: Idiomatic usage of partial
The reader notation is limited to the arity of the number of arguments provided. partial allows variable arity. Check out pages 67-68 of Clojure Programming. Regards, Greg On Wednesday, May 16, 2012 1:57:40 PM UTC-4, Murtaza Husain wrote: Hi, What is the idiomatic use of partial. I understand it helps create closures, however the reader notation also allows to the same. So when should partial be use dover other forms of creating functions. Thanks, Murtaza -- 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
does delay in calling clojure from java happen only once ?
I use clojure more and more in production. To use it even more there, I need to be certain about the answer of the following question. My experiments lead me to the conjecture, that the answer is yes. But a proof can only be given by someone, who is familiar with clojure's implementation of which I have no clue. Thanks for your help !: The question is concerned with calling clojure from Java. I have a bunch of clojure stuff, which I compiled to byte code with the techniques described at http://clojure.org/compilation I made an archive A of the result. I have Java code, that uses things from A. Now: The first time something from A is called, there is a little delay. Afterwards there is no delay. Is it true, that, in a given JVM, only the very first call to something in A, will cause a delay ? -- 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
NullPointerException
Hi! I have a problem. With that code: ; === ; ex 1.17 multiply (defn ex1_17 [] (defn double [x] (+ x x)) (defn halve [x] (/ x 2)) (defn * [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1) (println (* 5 5)) ) (ex1_17 ) I gave that exception: Exception in thread main java.lang.NullPointerException, compiling: (D:\workprivate\ll\1\src\first.clj:3) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.eval(Compiler.java:6515) at clojure.lang.Compiler.load(Compiler.java:6952) at clojure.lang.Compiler.loadFile(Compiler.java:6912) at clojure.main$load_script.invoke(main.clj:283) at clojure.main$script_opt.invoke(main.clj:343) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:415) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120) Caused by: java.lang.NullPointerException at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4774) at clojure.lang.Compiler$DefExpr.emit(Compiler.java:418) at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:5659) at clojure.lang.Compiler$FnMethod.doEmit(Compiler.java:5215) at clojure.lang.Compiler$FnMethod.emit(Compiler.java:5069) at clojure.lang.Compiler$FnExpr.emitMethods(Compiler.java:3600) at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4233) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3732) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453) ... 24 more Could you tell me where I wrong? -- 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: NullPointerException
Hi, Look at your parenthesis. You did not close your first function. Antoine 2012/5/17 Sargash gerby...@gmail.com Hi! I have a problem. With that code: ; === ; ex 1.17 multiply (defn ex1_17 [] (defn double [x] (+ x x)) (defn halve [x] (/ x 2)) (defn * [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1) (println (* 5 5)) ) (ex1_17 ) I gave that exception: Exception in thread main java.lang.NullPointerException, compiling: (D:\workprivate\ll\1\src\first.clj:3) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.eval(Compiler.java:6515) at clojure.lang.Compiler.load(Compiler.java:6952) at clojure.lang.Compiler.loadFile(Compiler.java:6912) at clojure.main$load_script.invoke(main.clj:283) at clojure.main$script_opt.invoke(main.clj:343) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:415) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120) Caused by: java.lang.NullPointerException at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4774) at clojure.lang.Compiler$DefExpr.emit(Compiler.java:418) at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:5659) at clojure.lang.Compiler$FnMethod.doEmit(Compiler.java:5215) at clojure.lang.Compiler$FnMethod.emit(Compiler.java:5069) at clojure.lang.Compiler$FnExpr.emitMethods(Compiler.java:3600) at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4233) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3732) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453) ... 24 more Could you tell me where I wrong? -- 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 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: NullPointerException
On Thu, May 17, 2012 at 10:55 AM, eniotna eniotn...@gmail.com wrote: Look at your parenthesis. You did not close your first function. some day we'll have the technology to let the compiler tell us that, instead of spewing some horrible, pointless, stack trace? -- 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: NullPointerException
Furthermore, The syntax you're using is not correct. If you want to define functions inside your function ex1_17, use letfn. Something along the line: (defn ex1_17 [] (letfn [(double [x] (+ x x)) (halve [x] (/ x 2)) (mult [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1)] (println (mult 5 5 I prefer not to mess with the default function so i redefined your * by mult Antoine 2012/5/17 eniotna eniotn...@gmail.com Hi, Look at your parenthesis. You did not close your first function. Antoine 2012/5/17 Sargash gerby...@gmail.com Hi! I have a problem. With that code: ; === ; ex 1.17 multiply (defn ex1_17 [] (defn double [x] (+ x x)) (defn halve [x] (/ x 2)) (defn * [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1) (println (* 5 5)) ) (ex1_17 ) I gave that exception: Exception in thread main java.lang.NullPointerException, compiling: (D:\workprivate\ll\1\src\first.clj:3) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.eval(Compiler.java:6515) at clojure.lang.Compiler.load(Compiler.java:6952) at clojure.lang.Compiler.loadFile(Compiler.java:6912) at clojure.main$load_script.invoke(main.clj:283) at clojure.main$script_opt.invoke(main.clj:343) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:415) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120) Caused by: java.lang.NullPointerException at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4774) at clojure.lang.Compiler$DefExpr.emit(Compiler.java:418) at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:5659) at clojure.lang.Compiler$FnMethod.doEmit(Compiler.java:5215) at clojure.lang.Compiler$FnMethod.emit(Compiler.java:5069) at clojure.lang.Compiler$FnExpr.emitMethods(Compiler.java:3600) at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4233) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3732) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453) ... 24 more Could you tell me where I wrong? -- 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 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: NullPointerException
2012/5/17 Raoul Duke rao...@gmail.com On Thu, May 17, 2012 at 10:55 AM, eniotna eniotn...@gmail.com wrote: Look at your parenthesis. You did not close your first function. some day we'll have the technology to let the compiler tell us that, emacs told me. But i'm sure some other editors can tell you that too. instead of spewing some horrible, pointless, stack trace? indeed. -- 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 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: does delay in calling clojure from java happen only once ?
This has nothing to do directly with Clojure :) The JVM needs to load the class(es) involved. It involves obtaining the class files from disk or cache if lucky (an already opened jar file ?). Then some wiring has to be done to insure that the references needed from the class(es) are met, After these steps then optimizations can kick in so future calls are optimized if necessary. The Clojure merely spits out classes like the Java compiler does. Luc I use clojure more and more in production. To use it even more there, I need to be certain about the answer of the following question. My experiments lead me to the conjecture, that the answer is yes. But a proof can only be given by someone, who is familiar with clojure's implementation of which I have no clue. Thanks for your help !: The question is concerned with calling clojure from Java. I have a bunch of clojure stuff, which I compiled to byte code with the techniques described at http://clojure.org/compilation I made an archive A of the result. I have Java code, that uses things from A. Now: The first time something from A is called, there is a little delay. Afterwards there is no delay. Is it true, that, in a given JVM, only the very first call to something in A, will cause a delay ? -- 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 -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- 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: does delay in calling clojure from java happen only once ?
Thank you, for your answer. It doesn't convince me, though. I am well aware of the class loading mechanism of the JVM. But if I compile against, say guava-12.0.jar (beautiful stuff by the way), and use those classes at runtime, there is no delay in using them whatsoever. At least not a delay of nearly a second on my machine, the first time I use bytecode generated by clojure. I am quite sure, that the bytecode generated by clojure, initializes some sort of Runtime for itself, the first time it is called. My question is, does this happen more than once ? Furthermore clojure does not spit out classes. It spits out bytecode. Heinz. -- 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: does delay in calling clojure from java happen only once ?
Ah, do you compile your Clojure code to Java prior to using it (AOT compilation) ? If not, you must add the clojure compilation time to spit out the class(es) byte code. Here we deliver AOTed components so there's no compilation overhead, we do this for other reasons than this very small overhead. Of course this will occur only once. Luc Thank you, for your answer. It doesn't convince me, though. I am well aware of the class loading mechanism of the JVM. But if I compile against, say guava-12.0.jar (beautiful stuff by the way), and use those classes at runtime, there is no delay in using them whatsoever. At least not a delay of nearly a second on my machine, the first time I use bytecode generated by clojure. I am quite sure, that the bytecode generated by clojure, initializes some sort of Runtime for itself, the first time it is called. My question is, does this happen more than once ? Furthermore clojure does not spit out classes. It spits out bytecode. Heinz. -- 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 -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- 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: does delay in calling clojure from java happen only once ?
Yes, I do compile my clojure code ahead of time (AOT) to byte code. Does that mean, that your, ahead of time compiled clojure code, has no noticeable delay, when you first call it ? If in the middle of the lifetime of an app, this delay happens, i can not consider it small, if 1 requests are waiting to be served. Heinz. -- 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: does delay in calling clojure from java happen only once ?
Compared to Java, not noticeable if any. We run our app in production on cluster of small computers. We replaced component written mostly in Java by Clojure equivalents without any degradation in service time. We used clojure from java a number of times using Java callable interfaces generated in Clojure (gen-class). Now it's the other way around. They're might be a bigger overhead if you call your code through the RT class instead of using generated APIs. Luc Yes, I do compile my clojure code ahead of time (AOT) to byte code. Does that mean, that your, ahead of time compiled clojure code, has no noticeable delay, when you first call it ? If in the middle of the lifetime of an app, this delay happens, i can not consider it small, if 1 requests are waiting to be served. Heinz. -- 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 -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- 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: NullPointerException
The redefinition of functions somehow is spooking the compiler. But if you're at the REPL you should be seeing these warnings (are you doing AOT compile?) WARNING: double already refers to: #'clojure.core/double in namespace: user, being replaced by: #'user/double WARNING: * already refers to: #'clojure.core/* in namespace: user, being replaced by: #'user/* Clojure 1.2 will compile regardless; later versions will produce the NPE. There's nothing wrong with your parens or your use of local functions. I just changed double to doubl and * to x and it all works fine. The stack trace isn't pretty but the warnings would've helped, so it's good to try things at the REPL. On Wednesday, May 16, 2012 3:25:20 PM UTC-7, Sargash wrote: Hi! I have a problem. With that code: ; === ; ex 1.17 multiply (defn ex1_17 [] (defn double [x] (+ x x)) (defn halve [x] (/ x 2)) (defn * [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1) (println (* 5 5)) ) (ex1_17 ) I gave that exception: Exception in thread main java.lang.NullPointerException, compiling: (D:\workprivate\ll\1\src\first.clj:3) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.eval(Compiler.java:6515) at clojure.lang.Compiler.load(Compiler.java:6952) at clojure.lang.Compiler.loadFile(Compiler.java:6912) at clojure.main$load_script.invoke(main.clj:283) at clojure.main$script_opt.invoke(main.clj:343) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:415) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120) Caused by: java.lang.NullPointerException at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4774) at clojure.lang.Compiler$DefExpr.emit(Compiler.java:418) at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:5659) at clojure.lang.Compiler$FnMethod.doEmit(Compiler.java:5215) at clojure.lang.Compiler$FnMethod.emit(Compiler.java:5069) at clojure.lang.Compiler$FnExpr.emitMethods(Compiler.java:3600) at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4233) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3732) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453) ... 24 more Could you tell me where I wrong? -- 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: NullPointerException
There's nothing wrong is a pretty strong statement. It works, but it is definitely the wrong way to do things. Using a letfn, or external helper functions, is a much better approach. On May 17, 12:19 pm, Armando Blancas abm221...@gmail.com wrote: The redefinition of functions somehow is spooking the compiler. But if you're at the REPL you should be seeing these warnings (are you doing AOT compile?) WARNING: double already refers to: #'clojure.core/double in namespace: user, being replaced by: #'user/double WARNING: * already refers to: #'clojure.core/* in namespace: user, being replaced by: #'user/* Clojure 1.2 will compile regardless; later versions will produce the NPE. There's nothing wrong with your parens or your use of local functions. I just changed double to doubl and * to x and it all works fine. The stack trace isn't pretty but the warnings would've helped, so it's good to try things at the REPL. On Wednesday, May 16, 2012 3:25:20 PM UTC-7, Sargash wrote: Hi! I have a problem. With that code: ; === ; ex 1.17 multiply (defn ex1_17 [] (defn double [x] (+ x x)) (defn halve [x] (/ x 2)) (defn * [a b] (cond (= b 0) 0 (even? b) (* (double a) (halve b)) :else (+ a (* a (- b 1) (println (* 5 5)) ) (ex1_17 ) I gave that exception: Exception in thread main java.lang.NullPointerException, compiling: (D:\workprivate\ll\1\src\first.clj:3) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6462) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6443) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.access$100(Compiler.java:37) at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:518) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6455) at clojure.lang.Compiler.analyze(Compiler.java:6262) at clojure.lang.Compiler.analyze(Compiler.java:6223) at clojure.lang.Compiler.eval(Compiler.java:6515) at clojure.lang.Compiler.load(Compiler.java:6952) at clojure.lang.Compiler.loadFile(Compiler.java:6912) at clojure.main$load_script.invoke(main.clj:283) at clojure.main$script_opt.invoke(main.clj:343) at clojure.main$main.doInvoke(main.clj:427) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:415) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.intellij.rt.execution.application.AppMain.main(AppMain.java: 120) Caused by: java.lang.NullPointerException at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4774) at clojure.lang.Compiler$DefExpr.emit(Compiler.java:418) at clojure.lang.Compiler$BodyExpr.emit(Compiler.java:5659) at clojure.lang.Compiler$FnMethod.doEmit(Compiler.java:5215) at clojure.lang.Compiler$FnMethod.emit(Compiler.java:5069) at clojure.lang.Compiler$FnExpr.emitMethods(Compiler.java:3600) at clojure.lang.Compiler$ObjExpr.compile(Compiler.java:4233) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3732) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6453) ... 24 more Could you tell me where I wrong? -- 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: Idiomatic usage of partial
#() syntax can accept as many arguments as you like. For example, you can define partial using #(): (defn partial [f args] #(apply f (concat args %))) On May 16, 7:13 pm, greg r gsra...@bellsouth.net wrote: The reader notation is limited to the arity of the number of arguments provided. partial allows variable arity. Check out pages 67-68 of Clojure Programming. Regards, Greg On Wednesday, May 16, 2012 1:57:40 PM UTC-4, Murtaza Husain wrote: Hi, What is the idiomatic use of partial. I understand it helps create closures, however the reader notation also allows to the same. So when should partial be use dover other forms of creating functions. Thanks, Murtaza -- 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: NullPointerException
It's called Emacs + Paredit :-) On Thu, May 17, 2012 at 8:00 PM, Raoul Duke rao...@gmail.com wrote: some day we'll have the technology to let the compiler tell us that, instead of spewing some horrible, pointless, stack trace? -- Moritz Ulrich -- 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: does delay in calling clojure from java happen only once ?
Hm. I do have the feeling, that we do not understand each other. Code is always unambigous. I give an example, and give my question another run. (ns p.x (:gen-class :methods [ ^{:static true} [f [] String] ])) (defn -f [] hello, world) Fire up a REPL, make sure, p/x.clj is in your classpath, as well as classes (the default value of *compile-path*) and do user= (compile p.x) Go out of the repl, cd into classes and do a $ jar cf a.jar * package e; import p.x; public final class E { public static void main(String[] args) { for (int i = 0; i 100; ++i) { System.out.println(x.f()); } } Fire up the java compiler (javac) on that Java source code, making sure, that he can find a.jar. Now run E with the java launcher, making sure than a.jar and clojure.jar are in its classpath. Something like so: $ java -cp a.jar:clojure.jar:./classes e.E Observation: --- The first hello world, takes a second or so to appear. The 99 following are coming super fast, like always. Question: -- 1. Am I doing something wrong or disadvantegous, and that is an explanation for the delay ? 2. If not, does this delay happen only once in a given JVM ? Thanks for your help. Heinz. -- 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: NullPointerException
There's nothing wrong is a pretty strong statement. LOL. Perhaps as strong as it is definitely the wrong way to do things? Jeez. Pedantry is the wrong way to welcome newbies to this board. -- 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: does delay in calling clojure from java happen only once ?
The following makes it clearer: package e; import p.x; public final class E { public static void main(String[] args) { System.out.println(before); for (int i = 0; i 100; ++i) { System.out.println(x.f()); } } Now: After launching, the string `before' gets printed (JVM up), and *then* there is delay, before the first `hello, world'. Jetzt aber. -- 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: NullPointerException
On Thu, May 17, 2012 at 12:52 PM, Armando Blancas abm221...@gmail.com wrote: Pedantry is the wrong way to welcome newbies to this board. stop with your pedantry about there must be no pedantry? -- 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: NullPointerException
On Thursday, May 17, 2012 12:52:27 PM UTC-7, Armando Blancas wrote: There's nothing wrong is a pretty strong statement. LOL. Perhaps as strong as it is definitely the wrong way to do things? Jeez. Pedantry is the wrong way to welcome newbies to this board. Far from being pedantic, Alan's advice was extremely practical. Anyone with moderate Clojure experience will agree that letfn or helper functions are actually what the OP wants, rather than def inside def. As a newcomer, it's helpful to find out about these kinds of things as early as possible. Your original advice, that There's nothing wrong with [...] your use of local functions not only fails to convey the fact that the OP's approach is probably not what they want -- it's also just plain wrong. Those are not local functions: def always operates at top-level. -- 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: NullPointerException
-- it's also just plain wrong. Those are not local functions: def always operates at top-level. Big deal. You see what I mean? Pedantry is contagious. -- 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: Avoid duplicate computation in commute?
I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe49b74605553/src/jvm/clojure/lang/LockingTransaction.java#L459 -S -- 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: NullPointerException
On Thu, May 17, 2012 at 1:25 PM, Armando Blancas abm221...@gmail.com wrote: -- it's also just plain wrong. Those are not local functions: def always operates at top-level. Big deal. You see what I mean? Pedantry is contagious. er, i should think it *is* a big deal: programming languages really don't give one much room / do give one plenty of rope to hang oneself by. (anybody remember the high-school thing where you have to write natural language instructions for somebody on how to make a peanut butter sandwich?) -- 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: does delay in calling clojure from java happen only once ?
It's the time to get all the related classes loaded needed to support the Clojure code and yes it's a one time cost. The first reference to x gets this triggered. Luc The following makes it clearer: package e; import p.x; public final class E { public static void main(String[] args) { System.out.println(before); for (int i = 0; i 100; ++i) { System.out.println(x.f()); } } Now: After launching, the string `before' gets printed (JVM up), and *then* there is delay, before the first `hello, world'. Jetzt aber. -- 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 -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- 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: Clojure Bee iPhone app updated
Hi Leo, At this time, there is only plans for the iOS app. However, since so many people are interested in the Android version, it's a possibility. Best, Kyle On Thursday, May 17, 2012 2:19:05 AM UTC-10, DonLeo wrote: Hello, It looks quite nice. Im hoping for an Android version though Leo Noordhuizen On Thu, May 17, 2012 at 11:53 AM, Roberto Mannai wrote: Looks interesting. Does it work off-line with local docs or require an Internet connection? BTW, do you know any Web Repl working on an iPhone or iPad? I tryied: - http://tryclj.com/ (well, it works but does not support a copy/past action) - http://lotrepls.appspot.com/ (it requires a submit via CTRL+ENTER, but the iPad does not have a CTRL button :) ) Thanks Rob On Thu, May 17, 2012 at 2:45 AM, mudphone wrote: Just a quick announcement that the Clojure Bee iPhone app was just updated. This release eliminates crashiness and updates the font for the source code view. More info on the app here: http://itunes.apple.com/us/app/clojure-bee-api-documentation/id524862532?ls=1mt=8 Anyone interested in a free copy, please email me directly (it's $1). I'm more than happy to give free copies to the Clojure community. Thanks! Kyle PS - It's called Clojure *Bee* because there is a quiz component, yet to be released (coming soon!). -- 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 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 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: NullPointerException
On Thursday, May 17, 2012 1:25:45 PM UTC-7, Armando Blancas wrote: -- it's also just plain wrong. Those are not local functions: def always operates at top-level. Big deal. You see what I mean? Pedantry is contagious. Well, I guess if trying not to give newcomers blatantly false information is what you consider pedantry, then I'm all for it, and I'm glad to hear that it's contagious. Also, *plonk*. -- 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: Assuring avalaibility of ring web apps
This is probably outside the scope of what Lein and Clojure do, but it's a well-studied problem for JVM apps. AWS itself has a variety of solutions, such as Elastic Beanstalk and Cloud Formation. At the OS-level, there's monit and its kin. -S -- 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: does delay in calling clojure from java happen only once ?
Yes, Clojure has a runtime which is initialized the first time you call any Clojure code. The initialization never happens more than once. -S -- 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: Avoid duplicate computation in commute?
Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe49b74605553/src/jvm/clojure/lang/LockingTransaction.java#L459 -S -- 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 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: does delay in calling clojure from java happen only once ?
Ah, cool ! Thank you very much for this insider knowledge, Mr. Sierra !!! Great. That means more clojure in production. Hurrah !!! Thanks again. Heinz. -- 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: Avoid duplicate computation in commute?
Thanks and these are certainly workable solutions. But is there any particular reason why with commute the update function is ALWAYS called twice, even when no other thread changed the ref value at the commit time? That is what bothers me. On May 17, 5:46 pm, DAemon forsakendae...@gmail.com wrote: Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe... -S -- 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 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: Avoid duplicate computation in commute?
The reason that comes to mind most easily for me is that of deciding which notion of equality to use for 'the value of Ref hasn't changed'. Also, short of keeping a counter on the Ref of the number of times it's been changed, and comparing on that, there's no other way to tell that no other thread has changed the Ref, as far as I know. Although I could be wrong, *throws question to the Gods of clojure* On Fri, May 18, 2012 at 8:03 AM, Warren Lynn wrn.l...@gmail.com wrote: Thanks and these are certainly workable solutions. But is there any particular reason why with commute the update function is ALWAYS called twice, even when no other thread changed the ref value at the commit time? That is what bothers me. On May 17, 5:46 pm, DAemon forsakendae...@gmail.com wrote: Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe. .. -S -- 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 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 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: Avoid duplicate computation in commute?
But I thought for a ref, all the checking if an another thread has changed the value behind my back facility/logic is already there (otherwise how can dosync and alter work, right?). So why not using that? I did send the question to Rich but not sure he will have time to attend this. I am still learning Clojure and so far like it (especially compared to the bad experience with Common Lisp), but my perfectionist side pokes me sometimes. On May 17, 6:42 pm, DAemon forsakendae...@gmail.com wrote: The reason that comes to mind most easily for me is that of deciding which notion of equality to use for 'the value of Ref hasn't changed'. Also, short of keeping a counter on the Ref of the number of times it's been changed, and comparing on that, there's no other way to tell that no other thread has changed the Ref, as far as I know. Although I could be wrong, *throws question to the Gods of clojure* On Fri, May 18, 2012 at 8:03 AM, Warren Lynn wrn.l...@gmail.com wrote: Thanks and these are certainly workable solutions. But is there any particular reason why with commute the update function is ALWAYS called twice, even when no other thread changed the ref value at the commit time? That is what bothers me. On May 17, 5:46 pm, DAemon forsakendae...@gmail.com wrote: Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe. .. -S -- 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 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 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: Avoid duplicate computation in commute?
Aren't alter and dosync just using LockingTransactions, which use the Java locking stuff under the hood? On Fri, May 18, 2012 at 9:28 AM, Warren Lynn wrn.l...@gmail.com wrote: But I thought for a ref, all the checking if an another thread has changed the value behind my back facility/logic is already there (otherwise how can dosync and alter work, right?). So why not using that? I did send the question to Rich but not sure he will have time to attend this. I am still learning Clojure and so far like it (especially compared to the bad experience with Common Lisp), but my perfectionist side pokes me sometimes. On May 17, 6:42 pm, DAemon forsakendae...@gmail.com wrote: The reason that comes to mind most easily for me is that of deciding which notion of equality to use for 'the value of Ref hasn't changed'. Also, short of keeping a counter on the Ref of the number of times it's been changed, and comparing on that, there's no other way to tell that no other thread has changed the Ref, as far as I know. Although I could be wrong, *throws question to the Gods of clojure* On Fri, May 18, 2012 at 8:03 AM, Warren Lynn wrn.l...@gmail.com wrote: Thanks and these are certainly workable solutions. But is there any particular reason why with commute the update function is ALWAYS called twice, even when no other thread changed the ref value at the commit time? That is what bothers me. On May 17, 5:46 pm, DAemon forsakendae...@gmail.com wrote: Would some of this difficulty be ameliorated by calling memoize on the function that you use? That way, if it's an expensive function, and the value hasn't changed, it's just looked up rather than recalculated. - DAemon On Fri, May 18, 2012 at 6:28 AM, Stuart Sierra the.stuart.sie...@gmail.comwrote: I think the point with `commute` is to allow for more concurrency at the expense of more computation. If you want assurance that your function is only called once, you can use `alter`. Keep in mind that *any* code in a Ref transaction has the potential to be called more than once if there's a conflict. All this doesn't mean that it's impossible to avoid the duplicate computation on `commute`. The code to study would be here: https://github.com/clojure/clojure/blob/8fda34e4c77cac079b711da59d5fe. .. -S -- 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 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 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 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: [ANN] Clojure Namespace Browser (clj-ns-browser 1.0.0)
it's ok I found the problem: it was due to another dependency, Aleph 0.2.1-SNAPSHOT, which depends on Apache HTTP components which are older versions than those used by ns-browser On Thursday, May 17, 2012 11:34:44 AM UTC+10, Andy Fingerhut wrote: Did you use the instructions under Install Start-up on this page? https://github.com/franks42/clj-ns-browser Also, what OS are you using (and if Windows, are you using Cygwin, too?), and what do you get as output of the command lein version? Thanks, Andy On May 16, 2012, at 6:16 PM, thenwithexpandedwingshesteershisflight wrote: I get NoSuchMethodError org.apache.http.conn.ssl.SSLSocketFactory.init(Lorg/apache/http/conn/ssl/TrustStrategy;)V clj-http.core/fn--5014 (core.clj:64) On Thursday, May 17, 2012 11:34:44 AM UTC+10, Andy Fingerhut wrote: Did you use the instructions under Install Start-up on this page? https://github.com/franks42/clj-ns-browser Also, what OS are you using (and if Windows, are you using Cygwin, too?), and what do you get as output of the command lein version? Thanks, Andy On May 16, 2012, at 6:16 PM, thenwithexpandedwingshesteershisflight wrote: I get NoSuchMethodError org.apache.http.conn.ssl.SSLSocketFactory.init(Lorg/apache/http/conn/ssl/TrustStrategy;)V clj-http.core/fn--5014 (core.clj:64) -- 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
Let over Lambda
Hi everyone, I was perusing Amazon for some books on Clojure and Lisp and came across Let Over Lambda. From its reviews, it seems that this book may be useful for macro development in Clojure. Has anyone else read this book? Do you think it would be a good book for Clojure work? 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
Re: Let over Lambda
It treats reader macros in some detail which is not really applicable to Clojure but it's a fun book :) On 18 May 2012 11:53, P Martin rawkso...@gmail.com wrote: Hi everyone, I was perusing Amazon for some books on Clojure and Lisp and came across Let Over Lambda. From its reviews, it seems that this book may be useful for macro development in Clojure. Has anyone else read this book? Do you think it would be a good book for Clojure work? 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 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: defstruct defrecord metadata
Is this thread related to http://dev.clojure.org/jira/browse/CLJ-304 ? Would be nice to address that issue. -FrankS. On May 16, 2012, at 6:54 AM, Tim Visher wrote: On Tue, May 15, 2012 at 12:11 PM, JDuPreez jacques...@gmail.com wrote: Maybe I should post my solution to this problem here? Sounds like a plan. :) -- 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 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: docstrings of if-let and when-let incorrect
Christophe Grand was experimenting with some extensions to if-let and when-let that had implicit ANDs for the let-forms: https://github.com/cgrand/parsley/blob/master/src/net/cgrand/parsley/util.clj It feels intuitive to me to allow multiple if-let-forms like cgrand implements, and I can certainly remember situations where I could have used such a feature. -FrankS. On May 16, 2012, at 11:26 AM, dgrnbrg wrote: I too assumed that if/when-let would support multiple bindings, short- circuiting if one failed, when I started learning Clojure. It seems that short-circuiting multiple bindings isn't surprising. On May 16, 10:56 am, Jay Fields j...@jayfields.com wrote: I've also attempted to use if/when-let with multiple bindings in the past. I assumed that it would behave as 'AND' and that no bindings would be available in 'else' Cheers, Jay On Wed, May 16, 2012 at 10:29 AM, Dan Cross cro...@gmail.com wrote: On Wed, May 16, 2012 at 9:16 AM, Aaron Cohen aa...@assonance.org wrote: On Wed, May 16, 2012 at 9:10 AM, Walter Tetzner robot.ninja.saus...@gmail.com wrote: To make the bindings work like let, where later bindings can see previous bindings, I think the most natural way to do it is to have the bindings behave like the maybe monad. [...] Saying something is obvious and then using the word monad a paragraph later is contradictory. ;) Hypothetically, this is obvious, unlike most monads. Zing! What should happen on the else branch of the if-let; which bindings are in scope and what would be their values? None of the bindings should be in scope. - Dan C. -- 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 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 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