Re: Clojure web server capacity
On 22/04/15 20:22, Thomas Heller wrote: As far as I know there is not a single Web Server actually written in Clojure, they are all written in Java and we just use them. http-kit would be one, although it's using netty which is a java io library. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure web server capacity
On 23/04/15 00:49, Thomas Heller wrote: You should check your sources. http-kit is not written in Clojure and does not use netty. You're right, I looked at it too quickly: the src directory is mostly java and the project.clj has a dev only dependency to netty. I always thought it was written in Clojure when I first heard about it, but in fact it's java for consumption in clojure. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: where do I think the wrong way
You also need to clarify your intention: are you adding an author to a list of authors, or setting the single author? I suppose the first, but then you need to be clear on what the list of authors is. , associated to the :authors key, look like. In idiomatic clojure you'll want it to be a vector of authors, so if an author is a map like {:name "Gerald J. Sussman"}, then :authors must be associated to a vector of maps. Also bear in mind that assoc is geared towards associative data structures such as maps, while assoc is geared towards sequential data structures such as vectors. That being said, you can still use assoc on vectors (indices are the keys) and use conj on maps (with a vector in the form of [key value]), but that's polymorphism convenience, not idiomatic. In the end add to a new author, you need to do: (assoc book :authors (conj (get book :authors) new-author)) Which can also be made more idiomatic as already mentioned: (update-in book [:authors] assoc new-author) The twisted way of doing it would be: (conj book [:authors (conj (:authors book) new-author)]) Try this in a REPL: (def book {:title "zbook" :authors [{:name "James"}]}) (def new-author {:name "Joe"}) (assoc book :authors (conj (get book :authors) new-author)) (update-in book [:authors] conj new-author) (conj book [:authors (conj (:authors book) new-author)]) On 29/10/14 12:20, Roelof Wobben wrote: Thanks James, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong number of args (2) passed to: core$assoc clojure.lang.AFn.throwArity (AFn.java:437) Roelof Op woensdag 29 oktober 2014 12:08:35 UTC+1 schreef James Reeves: On 29 October 2014 11:01, Roelof Wobben rwo...@hotmail.com wrote: For a exercise I have to add something to the end of a existing map. So I thought this would work : (defn add-author [book new-author] (assoc book (conj :authors new-author))) Take a look at that conj _expression_ on its own: (conj :authors new-author) You're trying to conjoin "new-author" onto the keyword :authors, but keywords aren't collections. That's what the error means. It's saying that it expected a collection, but you've supplied a keyword instead. What you want is: (conj (get book :authors) new-author) Which can also be written: (conj (book :authors) new-author) (conj (:authors book) new-author) These two expressions are shortcuts for the above "get" function. They work because maps and keywords can act as functions. - James -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new
Re: where do I think the wrong way
(oops my earlier message isn't quite right, here's the correct one) You also need to clarify your intention: are you adding an author to a list of authors, or setting the single author? I suppose the first, but then you need to be clear on what the list of authors is. In idiomatic clojure you'll want it to be a vector of authors, so if an author is a map like {:name "Gerald J. Sussman"}, then :authors must be associated to a vector of maps. Also bear in mind that assoc is geared towards associative data structures such as maps, while conj is geared towards sequential data structures such as vectors. That being said, you can still use assoc on vectors (indices are the keys) and use conj on maps (with a vector in the form of [key value]), but that's polymorphism convenience, not idiomatic. In the end add to a new author, you need to do: (assoc book :authors (conj (get book :authors) new-author)) Which can also be made more idiomatic as already mentioned: (update-in book [:authors] assoc new-author) The twisted way of doing it would be: (conj book [:authors (conj (:authors book) new-author)]) Try this in a REPL: (def book {:title "zbook" :authors [{:name "James"}]}) (def new-author {:name "Joe"}) (assoc book :authors (conj (get book :authors) new-author)) (update-in book [:authors] conj new-author) (conj book [:authors (conj (:authors book) new-author)]) On 29/10/14 12:20, Roelof Wobben wrote: Thanks James, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong number of args (2) passed to: core$assoc clojure.lang.AFn.throwArity (AFn.java:437) Roelof Op woensdag 29 oktober 2014 12:08:35 UTC+1 schreef James Reeves: On 29 October 2014 11:01, Roelof Wobben rwo...@hotmail.com wrote: For a exercise I have to add something to the end of a existing map. So I thought this would work : (defn add-author [book new-author] (assoc book (conj :authors new-author))) Take a look at that conj _expression_ on its own: (conj :authors new-author) You're trying to conjoin "new-author" onto the keyword :authors, but keywords aren't collections. That's what the error means. It's saying that it expected a collection, but you've supplied a keyword instead. What you want is: (conj (get book :authors) new-author) Which can also be written: (conj (book :authors) new-author) (conj (:authors book) new-author) These two expressions are shortcuts for the above "get" function. They work because maps and keywords can act as functions. - James -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to
Re: where do I think the wrong way
(oops my earlier message isn't quite right, here's the correct one) You also need to clarify your intention: are you adding an author to a list of authors, or setting the single author? I suppose the first, but then you need to be clear on what the list of authors is. In idiomatic clojure you'll want it to be a vector of authors, so if an author is a map like {:name "Gerald J. Sussman"}, then :authors must be associated to a vector of maps. Also bear in mind that assoc is geared towards associative data structures such as maps, while conj is geared towards sequential data structures such as vectors. That being said, you can still use assoc on vectors (indices are the keys) and use conj on maps (with a vector in the form of [key value]), but that's polymorphism convenience, not idiomatic. In the end add to a new author, you need to do: (assoc book :authors (conj (get book :authors) new-author)) Which can also be made more idiomatic as already mentioned: (update-in book [:authors] assoc new-author) The twisted way of doing it would be: (conj book [:authors (conj (:authors book) new-author)]) Try this in a REPL: (def book {:title "zbook" :authors [{:name "James"}]}) (def new-author {:name "Joe"}) (assoc book :authors (conj (get book :authors) new-author)) (update-in book [:authors] conj new-author) (conj book [:authors (conj (:authors book) new-author)]) On 29/10/14 12:20, Roelof Wobben wrote: Thanks James, But how do I use assoc with it I tried this : (defn add-author [book new-author] (assoc book (conj (book :authors) new-author))) but then I see this message : ArityException Wrong number of args (2) passed to: core$assoc clojure.lang.AFn.throwArity (AFn.java:437) Roelof Op woensdag 29 oktober 2014 12:08:35 UTC+1 schreef James Reeves: On 29 October 2014 11:01, Roelof Wobben rwo...@hotmail.com wrote: For a exercise I have to add something to the end of a existing map. So I thought this would work : (defn add-author [book new-author] (assoc book (conj :authors new-author))) Take a look at that conj _expression_ on its own: (conj :authors new-author) You're trying to conjoin "new-author" onto the keyword :authors, but keywords aren't collections. That's what the error means. It's saying that it expected a collection, but you've supplied a keyword instead. What you want is: (conj (get book :authors) new-author) Which can also be written: (conj (book :authors) new-author) (conj (:authors book) new-author) These two expressions are shortcuts for the above "get" function. They work because maps and keywords can act as functions. - James -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to
Re: Recursive definition in core.logic
I think this blog post should help: https://kotka.de/blog/2011/10/A_field_trip_into_logic_programming.html The site seems to have an invalid certificate so you may or may not want to proceed, but I just did and all is fine. On 21/09/14 17:07, Casper wrote: I have been looking through core.logic tutorials and while I "get it" I haven't had the big epiphany yet. One thing that keeps nagging me is how to make a relation that isn't "fixed". An example is https://github.com/swannodette/logic-tutorial in which there is defined some relations such as parent, child, son, daughter and granddaughter. As I see it these are all a fixed relationships in that they are a fixed distance from each other. For me that leads to the question, how do we then define the relationship 'descendant' (which would be the generalisation of child, grandchild etc)? Seems to me that this would involve a recursive definition, but I don't know how to make one like that. Any hints? This is the relevant code from the excellent tutorial made by swannodette, that I linked above: (ns logic-tutorial.tut1 (:refer-clojure :exclude [==]) (:use [clojure.core.logic]) (:use [clojure.core.logic.pldb])) (def rels (db [male 'Bob] [female 'Cindy] [parent 'John 'Cindy] [parent 'Jane 'Cindy] [parent 'John 'Bob] [parent 'Jane 'Bob])) (defn child [x y] (parent y x)) (defn son [x y] (all (child x y) (male x))) (defn daughter [x y] (all (child x y) (female x))) (defn grandparent [x y] (fresh [z] (parent x z) (parent z y))) (defn granddaughter [x y] (fresh [z] (daughter x z) (child z y))) ;; Running it (with-db rels (run* [q] (child 'Bob q))) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Why You Should NOT Implement Layered Architecture
On 16/09/14 10:11, Kalina Todorova wrote: Relevant? Well it is always nice to find different articles that are bashing on the issues that could appear from badly designed OO programs if you want to get Clojure into consideration in your organization. That's exactly why I posted the link: it was intended to those looking for arguments in favor of clojure, or at least in favor of deconstructing the babel tower that OO and enterprise frameworks have become. This article is not really against abstractions, layering, and overall general OO constructs, but about their abuse in the hope of gaining some sort on insurance against hypothetical change. The guy that wrote it is not totally naive either as he authored JOOQ, a library aimed at making it easier to integrate SQL in java, short-circuiting the ORM approach by providing a fluent SQL API. A kind of sqlkorma in java. Also I consider such article to be an example of how gradually the functional thinking and practices are penetrating the OO world, that it's not just language features such as immutability and closures that are making it through, but also a mindset in which do-all frameworks and over-layered architectures become smells, and in which the case for clojure becomes easier to make. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How do I track down a painfully long pause in a small web app?
GC would be the first suspect, but then it could also be combined with a swap issue, or a JVM bug. Have a look at this article, which ends with a concrete list of things to do: https://blogs.oracle.com/poonam/entry/troubleshooting_long_gc_pauses -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Class cast exception in Clojure
On 15/09/14 14:10, Gomzee wrote: Hello All, I am getting ClassCastException java.lang.String cannot be cast to java.util.concurrent.Future clojure.core/deref-future (core.clj:2180) while loading my file on REPL. Can any one suggest how to debug this error. Some mis-placed @ in front of a symbol? Like in this example: (let [s "string"] @s) = ClassCastException java.lang.String cannot be cast to java.util.concurrent.Future clojure.core/deref-future (core.clj:2180) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Class cast exception in Clojure
On 15/09/14 14:26, Gomzee wrote: Thanks, for your reply. Is there any other possibility of getting this error. As I have checked for the situation mentioned by you. Can you get a stacktrace? http://tech.puredanger.com/2010/02/17/clojure-stack-trace-repl/ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Why You Should NOT Implement Layered Architecture
Here is a link to an article which makes me think more people are seeing the light on the java side: http://java.dzone.com/articles/why-you-should-not-implement It's a nice illustrative demonstration that might be handy if you're looking for arguments for those left behind in Javaland/J22E/Spring ;) My 2 cents: don't believe layering is forbidden either, but know your trade-offs! -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How can I add meta to an object that doesn't implement IObj?
On 30/08/14 05:15, Atamert Ölçgen wrote: Obviously I can't. But I need to add this capability to an object. During testing I attach meta to this object that contains an atom. Then I pass this object to other functions, known in runtime. I can't use a dynamic var because all this happens within a mock function that may be retried and run in different threads. In my case I used a list, e.g. (list obj), and used destructuring on the other side when needed, e.g. [obj :as wobj]. I have seen this: http://stackoverflow.com/questions/20724219/simplest-possible-clojure-object-that-can-accept-a-primitive-and-metadata but can't deref it since I can't change the functions that will use it later. If I wrap this object I need to be able to delegate all of its functionality to the original object. I don't think there's a quick solution without changing the contract. Whatever solution is chosen you need to keep in mind how this will affect things like equality, hashing, and instanceof? Perhaps these links could be a start: https://groups.google.com/forum/#!topic/clojure/9zCGdW_Q7o8 https://groups.google.com/forum/#%21topic/clojure/9zCGdW_Q7o8 http://stackoverflow.com/questions/9086926/create-a-proxy-for-an-specific-instance-of-an-object-in-clojure Also, if the meta data is just for you own use, then you might want to store it yourself in a map with weak references, or just use WeakHashMap http://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html directly. But then you'll be stateful... -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Prismatic Schema: Unclear exception in subsequence validation
The resulting message is generated by the walk method of the s/Either record, see this line: https://github.com/Prismatic/schema/blob/ce582d1602abde47143a618745cdd079e0cdaf44/src/cljx/schema/core.cljx#L437 Perhaps removing the quote before 'schemas would make the message clearer: (list'some (list'check '% (utils/value-name x))schemas)) That would be a quick fix to avoid a strange message, and may have been what was intended originally (typo bug?). Otherwise one would have to change the logic, perhaps by accumulating the result of walking each contained schema and combine them perhaps like this: (conj'or res) the idea being to display a list of test for each schema or'ed together. I'm copying this in the prismatic mailing list for the record, perhaps Jason has further comments on this. François -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: 101 on simple and flexible graph query/update?
On 10/07/14 10:26, Bertrand Dechoux wrote: For both question 1) and 2), a more appropriate data structure might be the answer like a graph/semantic-like store (Datomic or something else). The questions are about intermediary solutions which would be less heavier. I would suggest you look into the walk http://clojuredocs.org/clojure_core/clojure.walk/walk/prewalk http://clojuredocs.org/clojure_core/clojure.walk/prewalk/postwalk http://clojuredocs.org/clojure_core/clojure.walk/postwalk functions. These are able to traverse arbitrary nested data structures while building a different or modified data structure. 3) How does Demeter lives with graph traversal? This law is often heard in the OOP world but it is a bit more general than that. When a long path on a superstructure is specified then if one intermediary layer is introduced later, all hardcoded paths will be broken ie in multiple locations in the code base. One would like to store local structure knowledge in a single place. How do you usually deal with this problematic? I have yet to take a serious look at lenses and their composition, they are probably an element of answer, but they are more often seen in more statically typed langage. The walk http://clojuredocs.org/clojure_core/clojure.walk/walk/prewalk http://clojuredocs.org/clojure_core/clojure.walk/prewalk/postwalk http://clojuredocs.org/clojure_core/clojure.walk/postwalk can support some resilience with respects to structural changes if one can recognize what any data structure represents at any level based on its content (e.g. a :type key). -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: 101 on simple and flexible graph query/update?
Also of interest is datomic datalog on regular clojure data structures and records: https://gist.github.com/stuarthalloway/2645453 https://gist.github.com/stuarthalloway/3068749 -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: System/getenv can't read env vars?
You probably need to export your var: http://stackoverflow.com/questions/1158091/defining-a-variable-with-or-without-export -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: OT: Github Alternatives
Tuleap http://www.tuleap.org/ is fully open source and integrates gitolite, gerrit, hudson/jenkins, etc. along with an agile dashboard, trackers, and more. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: OT: Github Alternatives
On 30/06/14 13:10, Torsten Uhlmann wrote: We successfully used http://assembla.com in the past. Except this cannot be hosted internally as requested by the OP... -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: lazy list comprehension
On 27/06/14 17:01, Glen Rubin wrote: I have a list that I want to combine in some way with an incremented list, so I was trying to write a for expression like this: (for [i '(my-list-of-crap), j (iterate inc 0)] (str i j)) I would also use map, otherwise try using (range) instead of your iterate. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojure equivalent of 3-level enumeration in Ruby?
On 20/06/14 15:11, gvim wrote: Because it's 3 levels deep and requires substituting the vars back into maps to then create a returned map. Your for example doesn't emulate Ruby's each_with_index, as in the example, as far as I'm aware. I'm fairly new to Clojure so the obvious may not be so obvious to me yet :) In that case destructuring http://blog.jayfields.com/2010/07/clojure-destructuring.html like in this example http://clojuredocs.org/clojure_core/clojure.core/for#example_618 and/or map-indexed http://clojuredocs.org/clojure_core/clojure.core/map-indexed could help. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: macro - unquote
http://clojure.org/reader#The Reader--Macro characters http://clojure.org/reader#The%20Reader--Macro%20characters -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to take a subsequence out of an infinite lazy sequence?
(keep-indexed #(if(=100 %1 1000)%2) (range1001)) = (100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 ...) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: How to take a subsequence out of an infinite lazy sequence?
On 15/06/14 18:11, Steve Miner wrote: You can use `drop` and `take` with infinite sequences. Something like this should work: (defn between [start end coll] (take (- end start) (drop start coll))) The `end` is exclusive as in `range`. Nice, especially since I suppose this will not incur the cost of = as in my answer. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: a data conversion question
(for[[k v] [[:a [1 2]] [:b [3 4]]] n v] [k n]) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: a data conversion question
If you really want a vector, just wrap my answer with (into [] ...): (into[] (for[[k v] [[:a [1 2]] [:b [3 4]]] n v] [k n])) = [[:a 1] [:a 2] [:b 3] [:b 4]] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: use :only in ns
This may help: https://groups.google.com/forum/#!msg/clojure/cFmCkdq9tQk/I23-uiqsEwEJ https://groups.google.com/forum/#%21msg/clojure/cFmCkdq9tQk/I23-uiqsEwEJ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: use :only in ns
On 05/06/14 08:29, Leonardo Borges wrote: I believe you want: (ns providence.core (:gen-class) (:require [seesaw.chooser :refer [choose-file]])) This will make available the whole seesaw.chooser namespace available via prefixed notation, with the bonus that choose-file which will be accessible without a namespace prefix. If just a couple vars are needed, then the :use :only is a preferable solution. (ns providence.core (:gen-class) (:use [seesaw.chooser :only [choose-file fn2 fn3 ...]])) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Propagating data through dependencies
I'm not sure I totally understand your use case, but somehow it sounds like these libraries may be of interest to you: propaganda https://github.com/tgk/propaganda prismatic graph https://github.com/prismatic/plumbing -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: go-circuit for clojure
On 10/05/14 22:59, Michał T. Lorenc wrote: Since, core.async has goroutines maybe it would be possible to implement go-circuit https://thestrangeloop.com/sessions/go-circuit-distributing-the-go-language-and-runtime for clojure to distrubute goroutines across computer nodes? In a previous topic https://groups.google.com/forum/#%21topic/clojure/27HCKTERBn8 about core.async over websocket + cljs + clojure was an argument https://groups.google.com/d/msg/clojure/27HCKTERBn8/CV7G-Folwr4J that sticks in my mind: trying to make distribution of processing transparent, ie look as local CSP using the same api as core.async, is probably not a good idea, since there may be semantic differences that may not be easy to resolve, e.g. blocking semantics, latency, and failure modes could be awkward to retrofit into an api designed for local CSP processing. A related concept is the one of leaky abstraction http://en.wikipedia.org/wiki/Leaky_abstraction, whereby the things below that have been abstracted (sort of made invisible) find a way to become painfully visible at the level above. This is not saying that it's impossible, it just requires a very careful design to avoid leakiness and complection. This isn't a new idea by the way, and if anyone would like to go that way, she/he should start by reading this paper https://github.com/jimweirich/presentation_10papers/blob/master/papers/smli_tr-94-29.pdf that concludes as follows: /A better approach is to accept that there are irreconcilabledifferences between local and distributed computing, andto be conscious of those differences at all stages of the //design and implementation of distributed applications.Rather than trying to merge local and remote objects, engi//neers need to be constantly reminded of the differencesbetween the two, and know when it is appropriate to use //each kind of object./ Anyway, I'm no specialist here but I thought this would be good references to start with. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: is there a performance test tool by clojure
On 06/05/14 15:32, Zhi Yang wrote: thanks, this is mainly for benchmark expression, what I need is a jmeter like app performance tool In that case: https://github.com/ptaoussanis/timbre -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: is there a performance test tool by clojure
On 06/05/14 15:34, François Rey wrote: On 06/05/14 15:32, Zhi Yang wrote: thanks, this is mainly for benchmark expression, what I need is a jmeter like app performance tool In that case: https://github.com/ptaoussanis/timbre Looking at what Gatling provides in scalaland I guess you may be interested in load testing, in which case The Grinder http://grinder.sourceforge.net/ may complete your toolbox since it support scenario scripting in clojure http://grinder.sourceforge.net/g3/clojure.html. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Measure HTTP response times
You may want to check timbre and/or The Grinder http://grinder.sourceforge.net/, the latter being a full-featured java tool that supports scenario scripting in clojure http://grinder.sourceforge.net/g3/clojure.html. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Sliding Windows
On 30/04/14 04:25, Paulo Suzart wrote: If anyone knows any other sliding window impl please share. Riemann seems to have one: http://riemann.io/howto.html#group-events-in-time -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: newbie seq question
On 14/04/14 01:29, Stephen Feyrer wrote: To be honest I am still not confident in what I'm doing but there are still avenues to explore. The REPL is you best friend, keep experimenting, keep reading, and I'm sure it will all make sense at some point. On 13/04/14 08:02, François Rey wrote: There's also this chapter from an online beginner's book I recommend (you may want to read the stuff before): http://www.braveclojure.com/read-and-eval/ To be more precise I should have written you may want to read the preceding chapters before. Enjoy! François -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: newbie seq question
On 13/04/14 02:21, Stephen Feyrer wrote: // Get the java file io library (import '(java.io http://java.io File)) // Get some files (def f (File. /My/files/)) (def fs (file-seq f)) // Filters for suffixes .mp3 (def get-mp3 (filter #(.endsWith (.getName %) .mp3) fs)) // Get the path of one mp3 (println (take 1 get-mp3)) This code is gathered from various unrelated Clojure forum posts. The resultant collection, I must admit defeats my understanding. My first question is the println statement returns (#File /My/files/path/to/Some of/My Music Collection.mp3), would someone explain this data structure for me, bearing in mind that white spaces and commas are synonymous. It's not a data structure, it's just the way clojure prints out java object: user= f #File /My/files In the REPL Clojure tries to print out readable output, meaning something that can be read again by the reader as input: user= (def a '(1 2 3)) #'user/a user= #'user/a #'user/a user= (var a) #'user/a user= map #core$map clojure.core$map@23130c0a In the case of object instances, it cannot be printed into such readable form, so it uses the # to indicate this is unreadable: user= #File /tmp clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Unreadable form java.lang.RuntimeException: Unreadable form See also the answer to this stackoverflow question: http://stackoverflow.com/questions/17263929/clojure-read-string-on-functions If you want to know more about reader macros: http://en.wikibooks.org/wiki/Learning_Clojure/Reader_Macros There's also this chapter from an online beginner's book I recommend (you may want to read the stuff before): http://www.braveclojure.com/read-and-eval/ Please note, while I have programmed a little in the past this does not prevent me from asking dumb questions. Thus finally, if this is not the appropriate place for this sort question could you point me in the right direction? You're perfectly fine here, newbies welcome. In fact your question is about something that isn't much talked or written about in clojure. HTH -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: alternative syntax for Clojure? Haskell?
On 05/04/14 19:35, Travis Wellman wrote: To be clear, in this topic I'm not interested in the functional purity of Haskell, nor it's libraries or type system, but just the syntax. It's probably not the answer you're looking for but did you check https://github.com/Frege/frege? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Function from a symbolic expression
On 31/03/14 23:25, Lee Spector wrote: (defn functionalise [ex var] (eval (list 'fn (vector var) ex))) (def ex '(+ 1 x)) (def exf (functionalise ex 'x)) (exf 3) ;; = 4 This calls eval only once when you call functionalise, and doesn't do any tree walking. FWIW this is the trick I use in the tiny genetic programming system at: https://github.com/lspector/gp/blob/master/src/gp/evolvefn.clj -Lee That would not work with a symbol other than x: (defexf (functionalise ex '*z*)) How about this: (defnfunctionalise [ex var] (eval`(fn[~(clojure.core/symbol xp)] ~(clojure.walk/postwalk-replace {var'xp}ex -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Function from a symbolic expression
On 31/03/14 23:51, François Rey wrote: On 31/03/14 23:25, Lee Spector wrote: (defn functionalise [ex var] (eval (list 'fn (vector var) ex))) (def ex '(+ 1 x)) (def exf (functionalise ex 'x)) (exf 3) ;; = 4 This calls eval only once when you call functionalise, and doesn't do any tree walking. FWIW this is the trick I use in the tiny genetic programming system at:https://github.com/lspector/gp/blob/master/src/gp/evolvefn.clj -Lee That would not work with a symbol other than x: (defexf (functionalise ex '*z*)) How about this: (defnfunctionalise [ex var] (eval`(fn[~(clojure.core/symbol xp)] ~(clojure.walk/postwalk-replace {var'xp}ex Forget that, my code does not work with 'z too, obviously. Too late, time to go to bed for me -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
On 30/03/14 07:40, Andy C wrote: Here are results where numbers are normalized gains. ++---++ | # of processes | random | linear| ++---++ |1 | 1.00| 1.00 | ++---++ |2 | 1.97| 1.76 | ++---++ |4 | 3.51| 1.83 | ++---++ |8 | 4.24| 1.86 | ++---++ This is great stuff. Let me make sure I read it correctly. Having 2 processes makes a value 1.97 times higher than with 1 core in the random case, and 1.76 times higher in the linear case, but what is that value being measured? Some form of throughput I suppose and not time, right? The conclusion is that in practice two cores can easily saturate memory buses. Accessing it in certain patters helps to some extend. Although 8 cores is pretty much all what makes sense unless you do tons of in cache stuff. Indeed. It also means single threaded linear access isn't going to be very much faster if you add more threads. BTW, are you sure the threads were running in parallel on separate cores and not just concurrently on a smaller number of cores? As you said, this should be dependent on hardware and running this on actual server machine would be as interesting. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: cdoc, lein, profiles.clj, strange behavior
Don't know if you still have the issue, but one way to solve it would be to use a prefix like as shown in the README.md https://github.com/zcaudate/vinyasa#inject---installation: (vinyasa.inject/inject 'clojure.core ' '[[cemerick.pomegranate add-classpath get-classpath resources] [clojure.tools.namespace.repl refresh] [clojure.repl apropos dir doc find-docsource pst [root-cause cause]] [clojure.pprint pprint] [clojure.java.shell sh]])]}} -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
On 20/03/14 04:03, Andy C wrote: So, the following test puzzles me. Not because it takes virtually the same time (I know that Fork/Join is not cheap and memory is probably the biggest bottleneck here). But because I do not get why map (as opposed to r/ma) uses all 8 cores on my MacBookPro. All of them seem to be running according to Activity Monitor at more less the same level. user= (def l (into [] (range 6000))) #'user/l user= (time (def a (doall (map #(Math/sin (* % %)) l Elapsed time: 19986.18 msecs user= (time (def a (doall (into [] (r/map #( Math/sin (* % %)) l) Elapsed time: 18980.583 msecs I would also expect this code to run on a single CPU at any one time, however process/thread scheduling can make this thread run on different cores at different times. Depending on the sampling method the activity monitor may display another picture of what you would expect. On my linux machine, the cpu history graph shows it's using mostly one cpu at any one time, but it's not always the same cpu. I think the JVM uses all cores by default, and there's no standard way to specify thread affinity http://stackoverflow.com/questions/2238272/java-thread-affinity. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
On 20/03/14 12:26, László Török wrote: into uses reduce under the hood, you probably need fold to have the computation to run on FJ: Yes, now I see all my CPUs being maxed-out. francois@laptop:~$ perf stat java -cp ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar clojure.main -e (require '[clojure.core.reducers :as r]) (let [l (into [] (range 1000))] (time (r/fold + (r/map #(Math/sin (* % %)) l Elapsed time: 1594.89737 msecs 678.1151045769922 Performance counter stats for 'java -cp /home/francois/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar clojure.main -e (require '[clojure.core.reducers :as r]) (let [l (into [] (range 1000))] (time (r/fold + (r/map #(Math/sin (* % %)) l': 23460.971496 task-clock# *4.728**CPUs utilized* 7,663 context-switches #0.000 M/sec 570 CPU-migrations#0.000 M/sec 174,586 page-faults #0.007 M/sec 68,361,248,389 cycles#2.914 GHz [83.33%] 44,379,949,020 stalled-cycles-frontend # 64.92% frontend cycles idle[83.21%] 22,520,594,887 stalled-cycles-backend# 32.94% backend cycles idle[66.75%] 63,715,541,342 instructions #0.93 insns per cycle #0.70 stalled cycles per insn [83.39%] 11,104,063,057 branches # 473.299 M/sec [83.25%] 155,172,776 branch-misses #1.40% of all branches [83.46%] 4.962656410 seconds time elapsed francois@laptop:~$ perf stat java -cp ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar clojure.main -e (require '[clojure.core.reducers :as r]) (let [l (into [] (range 1000))] (time (reduce + (map #(Math/sin (* % %)) l Elapsed time: 5694.224824 msecs 678.1151045768991 Performance counter stats for 'java -cp /home/francois/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar clojure.main -e (require '[clojure.core.reducers :as r]) (let [l (into [] (range 1000))] (time (reduce + (map #(Math/sin (* % %)) l': 21365.047020 task-clock# *2.324 CPUs utilized* 9,443 context-switches #0.000 M/sec 375 CPU-migrations#0.000 M/sec 164,960 page-faults #0.008 M/sec 64,028,578,416 cycles#2.997 GHz [83.21%] 39,016,283,425 stalled-cycles-frontend # 60.94% frontend cycles idle[83.26%] 21,038,585,232 stalled-cycles-backend# 32.86% backend cycles idle[66.77%] 63,857,091,972 instructions #1.00 insns per cycle #0.61 stalled cycles per insn [83.29%] 11,161,960,110 branches # 522.440 M/sec [83.48%] 138,372,839 branch-misses #1.24% of all branches [83.28%] 9.195138860 seconds time elapsed francois@laptop:~$ -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Finding maximum weighted graph matchings
I recently searched for other graph algorithms and did not find much more than what you probably know: JUNG, JGraphT, Loom, Tinkerpop. So my guess is that you'll be very lucky to find an implementation in java, let alone in clojure. Be prepared to write your own. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
On 18/03/14 18:03, Martin Thompson wrote: Our use of language in the technology industry could, for sure, be better. Take simple examples like RAM where random should be arbitrary, or don't get me started on people who misuse the term agnostic ;-) I would even say our use of abstractions in the tech industry could be better, most notably because of the law of leaky abstractions http://en.wikipedia.org/wiki/Leaky_abstraction: how abstractions such as RAM, GC, persistent data structure, etc. always have a limit at which the things they're supposed to abstract come back right in your face and you end up needing to be aware of the abstracted things. I think mechanical sympathy is all about dealing with leaky abstractions. The art of knowing and playing with the limits of our abstractions is what Rich Hickey would call knowing the trade-offs. I don't think the law of leaky abstraction has any formal underpinning, but using the concept of trade-off it's about what we gain from using an abstraction, which we often know very well because that's the whole point of using it, and what we loose, which is often the forgotten and darker side. In those terms an abstraction without leakiness is one that does not loose anything, whether in terms of information or capability. Know of any? Isn't the whole point of an abstraction to be hiding certain underlying aspects, therefore loosing seems to be part of the deal, meaning abstractions are leaky by nature? I think they are, but don't ask me for a proof. The thing is that our industry is based on layers upon layers of abstractions, whether at the physical level (integrated circuits, interfaces, etc.) or at the software level: binary (1GL) abstracted into assembly (2GL), then C language (3GL), etc. Virtual machines is now another level of abstraction which is probably here to stay, at least in terms of flexibility offered. So perhaps a key question is how many levels of abstraction can we afford before the whole thing becomes too difficult to manage. If think we even have situations where leakiness at one level makes another level even more leaky, at which point one needs to reconsider the whole stack of abstractions, perhaps from hardware up to programming language and runtime, and check for the soundness of the trade-offs made at each level, and then provide more than one choice. So in the end it's all about knowing the trade-off we make at each level of the stack we use. I don't think many of us do, this is becoming more and more obvious as the stack becomes higher and higher. We don't have to be a mechanic to drive a car. But it helps to know what we can expect from it, so we can better choose other modes of transportation when for example we need to travel 1000 km or miles in 4 hours, or travel with 10+ people, or travel where there's no road. End-users of computer programs don't have to know the mechanics. But programmers do if they want to excel at their trade. I don't think we can avoid this: space and time are inescapable dimensions of our material reality and there will always be trade-offs around them. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
On 16/03/14 18:24, Softaddicts wrote: I think that significant optimizations have to be decided at a higher level. I doubt that any of that can be implemented at the hardware level alone and let it decide on the fly. This sounds like magic, too good to be true. I am also quite convinced that optimizing in hardware single threaded and muti-threaded processing are antagonist goals given the current hardware designs. Martin hits a number of significant nails, we need to be aware of hardware limitations and we need to measure the impacts of our choices and change these within some reachable goals. However achieving 10% or less cpu idle time on a specific server architecture to me is not a goal. I'm interested by the constraints I have to met (business and physical ones) and playing within a large playground to meet these wether it involves using more powerful/specially designed hardware or using better software designs. I hear you well. Whether further progress comes from hardware and/or software doesn't matter, I just hope progress is being made somewhere and that we won't have to fiddle with hundreds of parameters as it's the case for the JVM right now. Until then, tedious experimentation will be the only way to ensure scaling does happen. Sure Martin's case at LMAX was extreme, not many people will have such concerns. But we're in an age where the need for scalability can be very sudden (e.g. popular phone app.). With servers nowadays that can have many CPUs and cores, and many Gb of RAM, one can easily hope that vertical scaling can be sufficient, but it's often not as simple as that. Vertical can even be more dangerous than horizontal, since in the horizontal case you probably architect for scaling right from start. So what works and doesn't work is valuable information, and initiatives such as the Reactive Manifesto http://www.reactivemanifesto.org/ are helpful because they provide guidelines. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
On 15/03/14 01:59, Andy C wrote: Maybe one day this idea http://en.wikipedia.org/wiki/Lisp_machine will come back, I mean in a new form .. That reminds me of this Urbit project http://www.urbit.org/, which is nowhere near usefulness at present, but deserves to be mentioned as a (radical) experiment striving to go back to the roots (ideally hardware) in order to break free from the inconsistencies of having grown separately the mechanical and semantic models. FoNC http://www.vpri.org/fonc_wiki/index.php/Idst is another example. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: STM and persistent data structures performance on mutli-core archs
Martin's point about immutable and persistent data structures is further developed in his interview on infoq http://www.infoq.com/interviews/reactive-system-design-martin-thompson, you can skim to point #9 if you're in a hurry. Overall what he says is that in terms of scalability of the development activity, immutability and persistence are great ideas, since we don't have to deal with non-deterministic behaviour any more. When one needs to scale the running system, meaning increasing the rate at which the persistent data structure is updated, these can lead to performance issues in various ways: - longer GC pauses because persistency increases the number of objects that are neither very short-lived nor long-lived, - contention because the root of the tree of the persistent data structure becomes the focal point of concurrency, - increased CPU cache misses since persistent data structures are trees that increasingly span larger non-contiguous and non-sequential parts of memory Of these the last point is probably the most painful, since there's no way to deal with it unless one reconsiders the whole persistent data structure. In other words increasing the number of threads and cores may eventually lower throughput because the time taken for dealing with these issues (GC pauses, locking, cache misses) grows larger than the time taken for useful computation. I can't backup any of this with actual data and experience. However I think this old thread about poor performance on multicore https://groups.google.com/forum/#%21topic/clojure/48W2eff3caU does provide a clear picture of the problem, which becomes even clearer with actual stats showing https://groups.google.com/d/msg/clojure/48W2eff3caU/FBFQp2vrWFgJCPUs https://groups.google.com/d/msg/clojure/48W2eff3caU/FBFQp2vrWFgJwere 83% idle https://groups.google.com/d/msg/clojure/48W2eff3caU/FBFQp2vrWFgJ, i.e. waiting for memory. Also one should view Martin's other vidoes on infoq http://www.infoq.com/author/Martin-Thompson to get a better understanding of his arguments. He's actually quite positive about Clojure in general. It's just that depending on the scalability and performance requirements, persistent data structures may not provide a satisfactory answer and could even lower throughput. On 14/03/14 18:01, ?? ? wrote: He talks about simple things actually. When you have any sort of immutable data structure and you want to change it from multiple threads you just must have a mutable reference which points to the current version of that data structure. Now, updates to that mutable reference are fundamentally serial. Whatever synchronization strategy you chose been that optimistic updates (atom) or queuing (agent) or locks you inevitably will have a contention on a large number of threads. When you will run on that you will also have hundred ways to solve a problem. There is nothing magical about persistent data structures on multi-core machines :) ???, 13 ? 2014 ?., 20:58:54 UTC+4 Andy C ???: Hi, So the other day I came across this presentation:http://www.infoq.com/presentations/top-10-performance-myths http://www.infoq.com/presentations/top-10-performance-myths The guy seems to be smart and know what he talks about however when at 0:22:35 he touches on performance (or lack of thereof) of persistent data structures on multi-core machines I feel puzzled. He seems to have a point but really does not back it with any details. There is also a claim that STM does not cooperate well with GC. Is it true? Thanks, Andy -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [soft/philosophical] event handers in cljs
On 10/03/14 15:37, juan.facorro wrote: I have taken this approach as well, but I can can't seem to find a good answer to this question: When you create a bunch of elements with their corresponding channels to handle certain events, how do you handle the closing of those channels and the termination of the related *go* blocks once you remove the elements? I'm not a specialist of core.async (so anyone please correct me if I'm wrong) but here's what I understand. Go blocks aggregate into FSMs which can be garbage collected http://stackoverflow.com/questions/18800440/javascript-and-garbage-collection like any other objects. When parked go blocks are queued into the channel. So what it comes down to is being mindful of where you keep references to channels. More precisely, don't hold a reference to the channel beyond the scope of its producers and its reading go blocks. That probably means locality of readers (go blocks) is often preferable to a longer-lived go block. I guess it's the same mindfulness that goes on when keeping references to call-back handlers. See also this discussion: https://groups.google.com/forum/#!topic/clojure/_KzEoq0XcHQ https://groups.google.com/forum/#%21topic/clojure/_KzEoq0XcHQ From Timothy you'll read that go block are garbage collected: When go's are parked, they are put into a queue on the channel, thus when the channel is unreachable (besides inside the go block) both are collected, and the thread of execution is effectively terminated. From Brandon Bloom you'll read that: Querying the state of a channel at worst leads to race conditions and at best leads to bad design. You're only supposed to close a channel from the producer side. So if you're the only writer, then you know if you've closed the channel or not. If there are multiple writers, then need to be coordinated in some way. Typically, they would alt! against reading from a control channel and writing to the output channel. When you get a shutdown signal from the control channel, you stop writing. (...) It is a programming error to write a message to a closed channel. close is not a resource cleanup operation, it is a control signal. It flows in the same direction as the messages sent on the channel itself. If the receiver were allowed to close the channel, then the sender would have no way of avoiding a closed/write race condition. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [ANN] Gorilla REPL initial release (0.1.2)
Great project! I just watched this interesting video http://vimeo.com/44968627 on reinventing the REPL which also talks about notebook/graphical REPL. This was further developed at Clojure/con 2012 http://www.youtube.com/watch?v=sSQ1dqqINrQ, and there's a project called Session on github https://github.com/kovasb/session. I certainly agree that notebook/graphical/interactive REPL is the way forward. Immutability and dataflow seem to be key ingredients there so I guess whatever Pedestal-app/Om become https://groups.google.com/forum/#%21topic/pedestal-users/jODwmJUIUcg, part of the requirements should be to make it easier to develop such tools. The recently demoed Wolfram Language http://www.youtube.com/watch?v=_P9HqHVPeik will probably increase the pressure towards such evolution in the computing community. -- 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: OT: Enterprise Schedulers
Considering your enterprise/cloud requirements, it seems that quartz (http://clojurequartz.info/) http://clojurequartz.info/ should be the closest to your needs. It's also integrated into Immutant (http://immutant.org/tutorials/jobs/) http://immutant.org/tutorials/jobs/. More generally in the clojure world there is this stackoverflow question that may help: http://stackoverflow.com/questions/21404130/periodically-calling-a-function-in-clojure I have not used any of these, it's just that I needed to answer the same question a few days ago. -- 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: OT: Enterprise Schedulers
Perhaps I should be more precise: quartz (http://quartz-scheduler.org/) http://quartz-scheduler.org/ is a java-based open source scheduler, and the link I gave earlier is to the clojure integration layer quartzite (http://clojurequartz.info/) http://clojurequartz.info/. Immutant (http://immutant.org/tutorials/jobs/) http://immutant.org/tutorials/jobs/ seems to use another integration library named quartz-clj (https://github.com/mdpendergrass/quartz-clj) https://github.com/mdpendergrass/quartz-clj. I have no idea how quartzite http://clojurequartz.info/ and quartz-clj https://github.com/mdpendergrass/quartz-cljcompare to each other. Finally the enterprise/proprietary version of quartz http://quartz-scheduler.org/ is named Terracotta Quartz Scheduler http://terracotta.org/products/quartz-scheduler and it includes the ability to specify where to run jobs. Do let us know what you find out and decide. -- 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: OT: Enterprise Schedulers
On 10/02/14 16:20, Toby Crawley wrote: Actually, Immutant has its own Quartz integration, and is not based on quartz-clj. You can, however, use the Quartzite API with the cluster-aware Quartz scheduler that Immutant provides if you prefer the Quartzite API over the Immutant one. - Toby Thanks for being more precise, as I said I've have not used any of these libraries, yet (project still in the starting block)... On 10/02/14 14:30, Adrian Mowat wrote: Also, if anyone else is interested in this space, I would love to hook up and bounce some ideas around. A scheduling library would provide much of what's needed for managing these jobs, but that would be at a level which may not be too low for certain use cases, e.g. finer control over job distribution, job composition, exception handling, manual retry, etc. A layer above the scheduler would make sense for this. Recently, while investigating the use of a finite state machine and thus searching for fsm libraries in the clojure world, I ended up looking at a couple fsm libraries used in pallet (http://palletops.com/) http://palletops.com/: - pallet-fsm (https://github.com/pallet/pallet-fsm) https://github.com/pallet/pallet-fsm - pallet-fsmop (https://github.com/pallet/pallet-fsmop) https://github.com/pallet/pallet-fsmop They are used in the pallet api for managing cloud operations on remote nodes: http://palletops.com/pallet/marginalia/0.8/uberdoc.html#pallet.core.primitives http://palletops.com/pallet/marginalia/0.8/uberdoc.html#pallet.api (see converge method) I don't know if you use pallet but this may be of interest, especially when reading the rationale: https://github.com/pallet/pallet-fsmop/wiki/Rationale An example of usage can also be found in this discussion: https://groups.google.com/forum/#!topic/pallet-clj/ZcBrmUn-mAI https://groups.google.com/forum/#%21topic/pallet-clj/ZcBrmUn-mAI From what I understand pallet-fsmop https://github.com/pallet/pallet-fsmop is based on pallet-fsm https://github.com/pallet/pallet-fsm and provides higher-level operations over sets of fsm that must have certain states for that purpose. These higher-level operations trigger the remote operation encapsulated by each fsm, adding some delay, timeouts, comprehensions, reducers, reporting, etc. So in your case one could imagine a similar library that uses a scheduling library instead of doing immediate or delayed execution. In any case a single library won't satisfy all your requirements, so you will have to choose a scheduling library and compose with others... -- 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: OT: Enterprise Schedulers
On 10/02/14 18:46, Adrian Mowat wrote: Thanks for the info. Quartz and it's Clojure DSLs seem to do some of what I need. I had a quick scan of the docs and they don't appear to support triggers that are not time based (on arrival of a file, on completion of a job etc) - but it was only a quick scan so I wondered if you had noticed these facilitates during your investigations? Yeah I could not find such custom trigger in the quartz api either. It makes sense since it's no longer about scheduling but instead reacting. So a separate abstraction/library would be better, e.g. a file watch library such as https://github.com/derekchiang/Clojure-Watch, that triggers an immediate job with the scheduler. -- 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.