Re: StackOverflowError
Hi Ru, Think of it this way...In Java you can't declare something as public from within a method. Ok, in Java this would break the object's contract but even if you look at languages like python, you still don't define global variables from within functions. I have seen python code where functions mutate some global but never defining a global. THe reasons are manyfold...For starters, any function that defines global vars should not be called a function. Upon invocation it has an immediate impact on the outside world and therefore you lose all the nice properties of pure functions. Secondly, if you define global vars from functions, presumably other functions will depend on these globals and so you can immediately see you've introduced time in you program, and the world is generally much simpler and testable without time. So basically, if you absolutely need mutable globals then the way to do it is to have a top-level 'def' that points to one of Clojure's reference types (atom, ref, agent etc). Alternatively, you could have a dynamic var that can be rebound under the 'binding' scope. That said, I am not a big fan of dynamic-bindings and rarely (to never) use them... hope that helps a bit, Jim On 08/11/13 14:43, Dimitrios Jim Piliouras wrote: You don't generally do global variable assignment in Clojure...it is seriously frowned upon and goes against the functional paradigm... I need to run now and I will be busy for the next 2 hours... perhaps someone else can explain if you are in a hurry? On Nov 8, 2013 2:34 PM, ru soro...@oogis.ru mailto:soro...@oogis.ru wrote: Jim, please, recommend a correct solution for global variable assignment. John, Indeed I would prefere technique with better performance. But, as I understand from scarce documentation, disj works with sets. And doesn't it recursive? пятница, 8 ноября 2013 г., 13:17:28 UTC+4 пользователь ru написал: Dear clojure-users, StackOverflowError clojure.lang.RT.nthFrom (RT.java:789) I got this error message during evaluation of count function call on a quite short list (about 200 elements). What can be reasons of the error. Any hints would be greatly appreciated. Sincerely, Ru -- -- 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 mailto: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 mailto:clojure%2bunsubscr...@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 mailto:clojure%2bunsubscr...@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: StackOverflowError
Yes, it is. I reworked my code and removed where it is possible global assignments through *def*, particulary, from the function *retract-fact*. But, I can not do without global mutations altogether, so I have to use atom, ref, agent etc., as you suggested. But, do mutation of these structures have better performance than simple reassignment of def? I understand that from theoretical point of view assignments, states, mutation ,.. etc. break functional cleanliness, but to solve specific partial tasks can we mix differnt even conflicting paradigms to gain maximum performance. Or not? суббота, 9 ноября 2013 г., 13:47:54 UTC+3 пользователь Jim foo.bar написал: Hi Ru, Think of it this way...In Java you can't declare something as public from within a method. Ok, in Java this would break the object's contract butО©╫ even if you look at languages like python, you still don't define global variables from within functions. I have seen python code where functions mutate some global but never defining a global. THe reasons are manyfold...For starters, any function that defines global vars should not be called a function. Upon invocation it has an immediate impact on the outside world and therefore you lose all the nice properties of pure functions. Secondly, if you define global vars from functions, presumably other functions will depend on these globals and so you can immediately see you've introduced time in you program, and the world is generally much simpler and testable without time. So basically, if you absolutely need mutable globals then the way to do it is to have a top-level 'def' that points to one of Clojure's reference types (atom, ref, agent etc). Alternatively, you could have a dynamic var that can be rebound under the 'binding' scope. That said, I am not a big fan of dynamic-bindings and rarely (to never) use them... hope that helps a bit, Jim On 08/11/13 14:43, Dimitrios Jim Piliouras wrote: You don't generally do global variable assignment in Clojure...it is seriously frowned upon and goes against the functional paradigm... I need to run now and I will be busy for the next 2 hours... perhaps someone else can explain if you are in a hurry? On Nov 8, 2013 2:34 PM, ru sor...@oogis.ru javascript: wrote: Jim, please, recommend a correct solution for global variable assignment. John, Indeed I would prefere technique with better performance. But, as I understand from scarce documentation, disj works with sets. And doesn't it recursive? О©╫О©╫О©╫О©╫О©╫О©╫О©╫, 8 О©╫О©╫О©╫О©╫О©╫О©╫ 2013О©╫О©╫., 13:17:28 UTC+4 О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫О©╫ ru О©╫О©╫О©╫О©╫О©╫О©╫О©╫: Dear clojure-users, StackOverflowError О©╫ clojure.lang.RT.nthFrom (RT.java:789) I got this error message during evaluation of count function call on a quite short list (about 200 elements). What can be reasons of the error. Any hints would be greatly appreciated. Sincerely, О©╫ RuО©╫ -- -- 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. -- -- 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: gemacl: Scientific computing application written in Clojure
Hi Andy: Thanks a lot for your reply. I'll do more careful testing in the very near future and there is surely a lot to optimize in my code. I must say I did expect computing speed reduction coming from an already optimized codebase with the perfomance critical parts written in C, and there is an intentional trade off in my porting effort to get something more maintainable, extensible and scalable. My future plans are to run in a cluster on something like EC2, because I've made the numbers and buying hardware isn't cost effective for us anymore (we paid around EUR 10K for our last big computer and we can do a lot of computing in the cloud for that money). Since the software is used for research, we tend to add features and change it so that it simulates the different scenarios coming out of our scientific discussions: This means we spend almost as much time coding as simulating, and having a higher level language like Clojure helps us enormously. I'll keep you posted about my future performance tests and the Open Source release of the software. Best, Jose. -- -- 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.
monads not working in Clojure 1.4.0
Hello I saw the following error when using monads in Clojure 1.4.0, however it worked fine in Clojure 1.5.1. Isn't monads compatible with 1.4.0? [org.clojure/clojure 1.4.0] [org.clojure/algo.monads 0.1.4] NoSuchMethodError clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap; clojure.algo.monads/loading--4910--auto-- (monads.clj:11) Thanks Gary -- -- 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: monads not working in Clojure 1.4.0
2013/11/9 Gary Zhao garyz...@gmail.com NoSuchMethodError clojure.lang.RT.mapUniqueKeys([Ljava/lang/Object;)Lclojure/lang/IPersistentMap; clojure.algo.monads/loading--4910--auto-- (monads.clj:11) It means you have some code compiled against 1.5.1 in monads, one of the other libraries or your own code. Run lein clean and try again. -- 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: Does Pedestal have a future in the long run
Stuart Halloway is doing a presentation and we’ll be dumping a lot more new stuff into the repository. I made a mistake in saying we had an announcement, it’s more just that we’ll be talking more publicly about what we’re working on following next week. -Ryan On November 8, 2013 at 5:39:34 PM, Andreas Liljeqvist (bon...@gmail.com) wrote: Will there by any presentation on Pedestal, or just announcements? On Fri, Nov 8, 2013 at 1:38 AM, Ryan Neufeld r...@thinkrelevance.com wrote: Speaking as a core Pedestal team member and engineer at Cognitect I can say we are very serious about continuing to grow and support Pedestal. It may be quiet, but we're using the entirety of Pedestal with a number of client and are fervently preparing a number of new features and improvements we plan to announce at the Conj next week. Further, we've even begun selling commercial support that includes Pedestal[1]. ClojureScript One was a huge influence on pedestal-app, but you're completely right that we've abandoned it and should probably wind things down there. Are there any other questions I can field while I'm here? -Ryan [1]: http://cognitect.com/Cognitect-Support-Services.pdf On Thursday, November 7, 2013 5:30:59 PM UTC-5, Marko Kocić wrote: Hi all, I'd like to hear opinions about Pedestal from the people that have been playing more with it. Right now I started looking at it, and like some of the things, but not sure should I invest more time learning it. While I do like some concepts, I'm not sure is it going to became abandonware like Clojurescript One (does anyone reemembers it anymore). So far, after initial splash, I haven't seen large community interest in it. The number of aproachable getting started guides and hands on tutorials is missing. That might change over time, but I'm afraid that next year this time we'll get another Clojurescript one page application framework not much related with Pedestal. How serious Cognitect/Relevance is about it? Best regards, 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. -- -- 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/XQ4wuUc0bCk/unsubscribe. 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.
Python doctest in clojure?
Hello, While reading about tests in Python, I found the doctest module : http://docs.python.org/3/library/doctest.html#module-doctest. Essentially, the idea is that the documentation of the function is parsed/evaluated. And if something looks like an example it is run and verified. The neat consequence is that there is a verified working example in the documentation (ie with the implementation) that can be requested from the repl. In Clojure, it should be quite simple to do the same or add a specific meta to a function to separate the explanation and the example(s). I was wondering if something like that already existed. Regards Bertrand -- -- 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: gemacl: Scientific computing application written in Clojure
Jose: On re-reading your original post, I noticed one statement you made that may be of interest: The resulting vector for each particle is then added (conj) to a global vector for latter storage. Do you mean that there is a single global vector that is conj'd onto by all N threads? Is this vector in a ref or atom, perhaps, and you use swap! or something similar to update it from all threads? If so, and if you do that frequently from each thread, then that part of your code is definitely not embarrassingly parallel, even if the rest of it is. Andy On Sat, Nov 9, 2013 at 8:06 AM, Jose M. Perez Sanchez m...@josemperez.comwrote: Hi Andy: Thanks a lot for your reply. I'll do more careful testing in the very near future and there is surely a lot to optimize in my code. I must say I did expect computing speed reduction coming from an already optimized codebase with the perfomance critical parts written in C, and there is an intentional trade off in my porting effort to get something more maintainable, extensible and scalable. My future plans are to run in a cluster on something like EC2, because I've made the numbers and buying hardware isn't cost effective for us anymore (we paid around EUR 10K for our last big computer and we can do a lot of computing in the cloud for that money). Since the software is used for research, we tend to add features and change it so that it simulates the different scenarios coming out of our scientific discussions: This means we spend almost as much time coding as simulating, and having a higher level language like Clojure helps us enormously. I'll keep you posted about my future performance tests and the Open Source release of the software. Best, Jose. -- -- 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.
Reactive Programming in Clojure
Hi all, I'm a young clojure developer. I work as Java developer, but I've falled in love with this fantastic language and I would like to help in some way. Actually I'm following Principles of Reactive Programminghttps://www.coursera.org/course/reactive on Coursera. It is all written in Scala, but I'm not that proficent on Scala, so I'm following it in Clojure, I'm writing some posts on how I'll following it. If anyone has the same need can follow me at http://reactiveclojure.blogspot.it, there is also a github repository where I'm posting the code to make the same assigment as in the coursera. I appreciate any hint you can give. See 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 --- 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.
Principles of reactive programming in Clojure
Hi, I'm a young clojure developer from Italy. I have made a blog that help people that want to follow https://www.coursera.org/course/reactive not writing code in Scala but in Clojure. If you are interested go to http://reactiveclojure.blogspot.it. I appreciate any hint :) -- -- 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: gemacl: Scientific computing application written in Clojure
Hi Andy: Yes, this breaks embarrassing parallelism indeed. When the calculations are done for real this isn't a problem though, because these conj operations to the global list would happen sporadically (in average once every couple of seconds or so) so the probability of a thread waiting for a significant amount of time is very low. In the short benchmarks I posted this happens every few milliseconds in average and it could be a problem. Honestly I don't expect even in the one conj every few ms case to have a problem there. I don't know how computationally expensive is the conj, but for every conj to the global list, at least a few dozens of thousands of random numbers are generated with the Mersenne Twister, and a similar number of other arithmetical operations are done. Several local conj operations inside the thread are also performed and in each of the few thousand steps maps are created and merged. The only way to know for sure is testing though, I'll post the results as soon as I can run a test. Thanks a lot. Best, Jose. -- -- 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: Python doctest in clojure?
The standard clojure.test namespace included in Clojure has this functionality (or something very similar) by default. You can attach tests as metadata to a function, either like: (defn foo {:test (fn [] (is (= (foo 1) 2)))} [x] (+ x 1)) Or like: (with-test (defn foo [x] (+ x 1)) (is (= (foo 1) 2))) - James On 9 November 2013 14:35, decho...@gmail.com wrote: Hello, While reading about tests in Python, I found the doctest module : http://docs.python.org/3/library/doctest.html#module-doctest. Essentially, the idea is that the documentation of the function is parsed/evaluated. And if something looks like an example it is run and verified. The neat consequence is that there is a verified working example in the documentation (ie with the implementation) that can be requested from the repl. In Clojure, it should be quite simple to do the same or add a specific meta to a function to separate the explanation and the example(s). I was wondering if something like that already existed. Regards Bertrand -- -- 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.