Re: How to implement a distributed and concurrent system in Clojure?
Hi I'm surprised nobody mentioned storm yet. It's massively scalable real-time computing, using clojure. Le 3 juil. 2013 16:18, "Softaddicts" a écrit : > clj-zookeeper + avout. We run our solution on clusters of small nodes, we > needed > a lightweight solution. We implemented cluster queues and use avout > locking. > Our configuration is also stored in zookeeper as clojure expressions. > > We isolated this in a coordinator module so nothing spills out in the rest > of the code. > We could swap this for another alternative with minimal headaches but so > far it scales > pretty well. > > For inter cluster exchanges we are using zeromq but we do not need the same > tight intra cluster integration. > > Luc P. > > > > I'd like to hear others opinions on this too. I don't believe Clojure has > > anything built in at this point. My plan of action (not yet implemented) > is > > to use gearman(possibly java, but it seems that it is no longer updated) > > and zeroconf for clusters (just for automatic master determination). > > > > I know there is support for Hadoop in Clojure as well, which does not fit > > my needs but may fit your needs. A quick google search will get you > started. > > > > Immutant has support for clustering too, but I believe it requires > > leiningen to start, where I need to compile everything into a single jar. > > Immutant under the hood is using JBoss' message queue, so that may be an > > option to explore as well. > > > > I'm curious what others are doing. > > > > Best., > > --Joseph > > > > On Wednesday, July 3, 2013 4:26:53 AM UTC-5, Hussein B. wrote: > > > > > > Hi, > > > > > > I read recently on the internet that Clojure concurrency tools make it > > > easy to implement a highly concurrent system but on a single machine. > > > > > > But how to implement a highly concurrent system that runs on a multiple > > > machines? > > > > > > Erlang, Elixir and Scala have the Actors model. > > > > > > Please correct me if I'm wrong. > > > > > > Thanks for help and 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/groups/opt_out. > > > > > > > -- > Softaddicts sent by ibisMail from my ipad! > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to implement a distributed and concurrent system in Clojure?
Please keep in mind that Scala's "Actor Model" is a very thin piece of code that is not inherently distributed. There are a ton of issues in Scala related to crossing address spaces. Scala is not nearly as biased to immutability as Clojure. Sure, there are case classes, but case classes can easily contain mutable data. When I wrote Goat Rodeo (http://goatrodeo.org), I wrote a compiler plugin that guaranteed immutability and serializability of the data structures used for Goat Rodeo's Actor-based messaging... and this lead to the second issue... Having a class-based design means that one has to deal with serializing/deserializing class-based data structures. This is a huge problem. It means that the inter-process data structures must contain class signatures... and for distributed systems that are going to have 100% uptime, that means version and class signatures so that a message sent from a version 1 system can be deserialized on a version 2 system even if the class has changed. Long story short... Akka, the only popular distributed system in Scala, is marginally better than RMI/J/EE, so for enterprise java shops, it's great (much like Spring was.) But it's not something to aspire to. If I get some time, I'll work on a distributed version of core.async. The only real challenge I can see is marshalling a Channel identifier across address spaces. Everything else should be a walk in the park. On Wed, Jul 3, 2013 at 5:26 PM, Hussein B. wrote: > Hi, > > I read recently on the internet that Clojure concurrency tools make it > easy to implement a highly concurrent system but on a single machine. > > But how to implement a highly concurrent system that runs on a multiple > machines? > > Erlang, Elixir and Scala have the Actors model. > > Please correct me if I'm wrong. > > Thanks for help and 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/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.
which one would you prefer (instantiate vs. new-instance)?
(defmacro instantiate "Returns an instance of the given class. Depending on the argument list will invoke the corresponding constructor." [cl-name & args] `(eval (list 'new ~cl-name ~@args))) (defn new-instance "Create a new instance of the specified class using reflection." [^Class c & args] (if (empty? args) (.newInstance c) (.newInstance (.getConstructor c (into-array (map class args))) (to-array args any particular preference? Jim -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [ANN] Pedestal 0.1.9 has been released
Ryan - However expecting the Christmas this Monday :) On Wednesday, July 3, 2013 9:01:09 PM UTC+5:30, Manuel Paccagnella wrote: > > I'm sure I will :) In the meantime, I'll dive in the "Application > Overview" section to wrap my head around all the moving parts. Loving it so > far! Nice job. > > Il giorno mercoledì 3 luglio 2013 13:08:11 UTC+2, Ryan Neufeld ha scritto: >> >> It's so close I can almost taste it. Most Relevance Pedestallions are >> going to be doing what I think is a final review on Friday. >> >> I really think you folks are going to enjoy it. >> >> -- Ryan Neufeld >> >> On Jul 3, 2013, at 6:47 AM, Leon Talbot wrote: >> >> Brenton has been working hard at preparing a full tutorial of >> pedestal-app. >> We're expecting to release that in just under a month or so. >> >> >> Great news! >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=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/gHAxWvNleGg/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> clojure+u...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_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: which one would you prefer (instantiate vs. new-instance)?
Looks like the tradeoffs are composability vs avoiding reflection. I personally would go for the function until performance becomes a concern. Being able to use it in HOFs is a big deal! On Thursday, July 4, 2013 12:57:32 PM UTC+2, Jim foo.bar wrote: > > (defmacro instantiate > "Returns an instance of the given class. Depending on the argument list will > invoke the corresponding constructor." > [cl-name & args] > `(eval (list 'new ~cl-name ~@args))) > > (defn new-instance "Create a new instance of the specified class using > reflection." > [^Class c & args] > (if (empty? args) (.newInstance c) > (.newInstance > (.getConstructor c (into-array (map class args))) > (to-array args > > > any particular preference? > > Jim > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: which one would you prefer (instantiate vs. new-instance)?
On 04/07/13 12:31, Robert Stuttaford wrote: Looks like the tradeoffs are composability vs avoiding reflection. I personally would go for the function until performance becomes a concern. Being able to use it in HOFs is a big deal! performance is not good with either of those solutions (compared to a direct 'new' call). one involves reflection and the other involves a full-blown compilation step! you could write the macro as a function... Jim -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: which one would you prefer (instantiate vs. new-instance)?
Is there a solid reason for "instantiate" not to be a plain old function too? OK, the namespace the eval takes place in might change, but if that's causing a problem with importing it seems that using (instantiate `MyClass args...) should result in sending it the fully qualified classname, if it's been imported in the namespace containing the call, rendering the eval namespace issue moot. On the other hand, is eval any faster than .newInstance here? It's actually compiling a short piece of new bytecode and then invoking it. I wouldn't be surprised if it was slower. On Thu, Jul 4, 2013 at 7:31 AM, Robert Stuttaford < robert.stuttaf...@gmail.com> wrote: > Looks like the tradeoffs are composability vs avoiding reflection. I > personally would go for the function until performance becomes a concern. > Being able to use it in HOFs is a big deal! > > > On Thursday, July 4, 2013 12:57:32 PM UTC+2, Jim foo.bar wrote: >> >> (defmacro instantiate >> "Returns an instance of the given class. Depending on the argument list will >> invoke the corresponding constructor." >> [cl-name & args] >> `(eval (list 'new ~cl-name ~@args))) >> >> (defn new-instance "Create a new instance of the specified class using >> reflection." >> [^Class c & args] >> (if (empty? args) (.newInstance c) >> (.newInstance >> (.getConstructor c (into-array (map class args))) >> (to-array args >> >> >> any particular preference? >> >> Jim >> >> -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- 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: Pedestal introduction question
Hi, I am pretty new to clojure and trying to learn a lot from this great list anyway, looking at the code you point to, it seems that the name "templates" has two roles: - one deriving from: (:require ... [io.pedestal.app.render.push.templates :as templates] ...) - one deriving from: (def templates (html-templates/hello-world-templates)) looks like the one used for calling add-template etc. is the first one hth -Gianluca -- -- 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: which one would you prefer (instantiate vs. new-instance)?
Both are somewhat problematic from a performance perspective. I'd actually be tempted to do this in a "higher order function" style that returns a compiled construction function for the correct argument types, e.g. something like (def double-builder (instantiator Double Long)) (double-builder 2) => 2.0 This allows you to take the pay the cost of compilation / reflection only once. On Thursday, 4 July 2013 11:57:32 UTC+1, Jim foo.bar wrote: > > (defmacro instantiate > "Returns an instance of the given class. Depending on the argument list will > invoke the corresponding constructor." > [cl-name & args] > `(eval (list 'new ~cl-name ~@args))) > > (defn new-instance "Create a new instance of the specified class using > reflection." > [^Class c & args] > (if (empty? args) (.newInstance c) > (.newInstance > (.getConstructor c (into-array (map class args))) > (to-array args > > > any particular preference? > > Jim > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: which one would you prefer (instantiate vs. new-instance)?
hmm...unless I've understood wrongly, that would be 'once per type, arity and potentially argument-types'...so yes, for all your Doubles you would pay it once, for all your Longs once more etc etc...if you start doing it with objects with more than one ctor arity and possibly same arities but with different arg-types then I don't see how the instantiator would know about all potential possibilities. I mean it's not generic anymore... have I completely misunderstood you? can you show a sample/overview of the 'instantiator' fn you're referring to? thanks, Jim On 04/07/13 13:04, Mikera wrote: Both are somewhat problematic from a performance perspective. I'd actually be tempted to do this in a "higher order function" style that returns a compiled construction function for the correct argument types, e.g. something like (def double-builder (instantiator Double Long)) (double-builder 2) => 2.0 This allows you to take the pay the cost of compilation / reflection only once. On Thursday, 4 July 2013 11:57:32 UTC+1, Jim foo.bar wrote: (defmacro instantiate "Returns an instance of the given class. Depending on the argument list will invoke the corresponding constructor." [cl-name & args] `(eval (list 'new ~cl-name ~@args))) (defn new-instance "Create a new instance of the specified class using reflection." [^Class c & args] (if (empty? args) (.newInstance c) (.newInstance (.getConstructor c (into-array (map class args))) (to-array args any particular preference? Jim -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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: which one would you prefer (instantiate vs. new-instance)?
You've understood correctly - you'd need to create an instantiator for each different set of argument types. Whether this suits you or not will depend on your use case: however in the (possible quite common?) situation that you are doing a lot of runtime instantiation using the same argument types then I think it is a big win. You can also still define new-instance in terms of the instantiator if you like, using something like: (defn new-instance "Create a new instance of the specified class with the given args." [^Class c & args] (apply (apply instantiator c (map class args)) args)) On Thursday, 4 July 2013 13:37:04 UTC+1, Jim foo.bar wrote: > > hmm...unless I've understood wrongly, that would be 'once per type, > arity and potentially argument-types'...so yes, for all your Doubles you > would pay it once, for all your Longs once more etc etc...if you start > doing it with objects with more than one ctor arity and possibly same > arities but with different arg-types then I don't see how the instantiator > would know about all potential possibilities. I mean it's not generic > anymore... > > have I completely misunderstood you? can you show a sample/overview of the > 'instantiator' fn you're referring to? > > thanks, > > Jim > > > On 04/07/13 13:04, Mikera wrote: > > Both are somewhat problematic from a performance perspective. > > I'd actually be tempted to do this in a "higher order function" style > that returns a compiled construction function for the correct argument > types, e.g. something like > > (def double-builder (instantiator Double Long)) > (double-builder 2) > => 2.0 > > This allows you to take the pay the cost of compilation / reflection > only once. > > On Thursday, 4 July 2013 11:57:32 UTC+1, Jim foo.bar wrote: >> >> (defmacro instantiate >> "Returns an instance of the given class. Depending on the argument list will >> invoke the corresponding constructor." >> [cl-name & args] >> `(eval (list 'new ~cl-name ~@args))) >> >> (defn new-instance "Create a new instance of the specified class using >> reflection." >> [^Class c & args] >> (if (empty? args) (.newInstance c) >> (.newInstance >> (.getConstructor c (into-array (map class args))) >> (to-array args >> >> >> any particular preference? >> >> Jim >> >> -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clo...@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+u...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+u...@googlegroups.com . > For more options, visit https://groups.google.com/groups/opt_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.
Anybody has tried to (re)write re-match in core.logic?
I was thinking about rewriting re-match in core.logic, so I am asking if somebody tried something similiar. My reasoning goes along like this: 1) core.logic has no utils for dealing \w strings 2) regular expressions are declarative 3) (re-match expression string) is a relation I am hoping to get out of it a tool for easily generating/unifying strings. Do you think it would be a good idea? Has anybody tried? Thanks for feedback! Adam -- -- 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: Pedestal introduction question
Where did you see the first :require? I can't find it in the code sample. > one deriving from: > (:require ... > [io.pedestal.app.render.push.templates :as templates] > ...) Thanks, Greg -- Sent from my mobile device. Please do not email me anything that you are not comfortable also sharing with the NSA. On Jul 4, 2013, at 7:41 AM, gianluca torta wrote: > Hi, > > I am pretty new to clojure and trying to learn a lot from this great list > > anyway, looking at the code you point to, it seems that the name "templates" > has two roles: > one deriving from: > (:require ... > [io.pedestal.app.render.push.templates :as templates] > ...) > one deriving from: > (def templates (html-templates/hello-world-templates)) > > looks like the one used for calling add-template etc. is the first one > > hth > > -Gianluca > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Anybody has tried to (re)write re-match in core.logic?
Until core.logic gets environment trimming not a good idea as it us unable to handle medium to large inputs. David On Thursday, July 4, 2013, Adam Saleh wrote: > I was thinking about rewriting re-match in core.logic, so I am asking if > somebody tried something similiar. > > My reasoning goes along like this: > > 1) core.logic has no utils for dealing \w strings > 2) regular expressions are declarative > 3) (re-match expression string) is a relation > > I am hoping to get out of it a tool for easily generating/unifying strings. > > Do you think it would be a good idea? > Has anybody tried? > Thanks for feedback! > > Adam > > -- > -- > 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 '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 '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 '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: which one would you prefer (instantiate vs. new-instance)?
The HOF can achieve very good performance if by caching the constructor object. Just be careful to clear the cache when the class is GC'd, otherwise you can end up with memory leaks and/or class cast exceptions. On Thursday, July 4, 2013 4:31:40 AM UTC-7, Robert Stuttaford wrote: > > Looks like the tradeoffs are composability vs avoiding reflection. I > personally would go for the function until performance becomes a concern. > Being able to use it in HOFs is a big deal! > > On Thursday, July 4, 2013 12:57:32 PM UTC+2, Jim foo.bar wrote: >> >> (defmacro instantiate >> "Returns an instance of the given class. Depending on the argument list will >> invoke the corresponding constructor." >> [cl-name & args] >> `(eval (list 'new ~cl-name ~@args))) >> >> (defn new-instance "Create a new instance of the specified class using >> reflection." >> [^Class c & args] >> (if (empty? args) (.newInstance c) >> (.newInstance >> (.getConstructor c (into-array (map class args))) >> (to-array args >> >> >> any particular preference? >> >> Jim >> >> -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Pedestal introduction question
right, sorry! I found the double role of "template" in this sample file on the pedestal repo: https://github.com/pedestal/samples/blob/master/chat/chat-client/app/src/chat_client/web/rendering.cljs maybe the doc you originally refer to is inspired by this, but something got lost in the doc -Gianluca -- -- 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.
core.async JAR
Is there a prebuilt binary JAR of core.async available somewhere? I did not find it on Clojars. -- -- 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: Anybody has tried to (re)write re-match in core.logic?
Adam Saleh writes: Hi Adam, > 3) (re-match expression string) is a relation Well, for a given string there are infinitely many regexps that match it. And the other way round, for many regexps there are also infinitely many strings. Not sure if core.logic can do relations between infinite sets... Bye, Tassilo -- -- 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: core.async JAR
pmf writes: > Is there a prebuilt binary JAR of core.async available somewhere? I > did not find it on Clojars. Clone the git repository and do a "lein jar" in there. Bye, Tassilo -- -- 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: Pedestal introduction question
Thanks! Yeah it's probably just a mistake in the docs. -- Please do not email me anything that you are not comfortable also sharing with the NSA. On Jul 4, 2013, at 10:08 AM, gianluca torta wrote: > right, sorry! > > I found the double role of "template" in this sample file on the pedestal > repo: > https://github.com/pedestal/samples/blob/master/chat/chat-client/app/src/chat_client/web/rendering.cljs > > maybe the doc you originally refer to is inspired by this, but something got > lost in the doc > > -Gianluca > > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: core.async JAR
On 4 July 2013 15:20, pmf wrote: > Is there a prebuilt binary JAR of core.async available somewhere? I did > not find it on Clojars. If you want it as a dependency, add the following repository to your project file: :repositories {"sonatype-oss-public" " https://oss.sonatype.org/content/groups/public/"} And then add the dependency: [org.clojure/core.async "0.1.0-SNAPSHOT"] - 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/groups/opt_out.
Web crawling tree traversal
Hi everybody I'm a clojure newbie, so I'm sorry if I'm asking a dumb question. I'm trying to write a program to crawl a webpage, find all links and recursively do this until all the links in the website is crawled (of course I'm omitting external hosts to avoid infinite crawling). So basically I'm dealing with a tree data structure. The problem is that my knowledge of clojure data structures are no where near enough to be able to implement this. I read a little bit about zippers and lots of other stuff but it only made me more confused. This is what I've got so far: (ns cralwer.core (:gen-class) (:require [net.cgrand.enlive-html :as h]) (:import (java.net URL MalformedURLException)) (:import java.io.FileNotFoundException) ) (defn get-absolute-url-same-host "Convert the URL to absolute form if it's already not. Returns nill if the url is not from the same host" [url parent] (try (let [u (URL. url)] (if (= (.getHost u) (.getHost parent)) (.toString u))) (catch MalformedURLException e (.toString (URL. parent url))) )) (defn get-links "Return all the links in a URI" [url links] ;I do this check to avoid back edges/already seen urls and stop when there are no links in the current page (if-not (or (nil? url) (some #{url} links)) (try (let [j-url (java.net.URL. url) page (h/html-resource j-url)] (map #(get-absolute-url-same-host (:href (:attrs %)) j-url) (h/select page [(h/attr? :href)]))) (catch FileNotFoundException e (println "invalid URL: " url) (defn get-all-links "Return a collection of all links" [url] (let [links '() children (get-links url links)] (concat links (mapcat get-all-links children For small inputs, I get an empty list and for large inputs I just get stack overflow exception. Thanks a lot for your help in advance -- -- 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.
How core.async compares to agents, future and promise?
Hi, How core.async compares to agents, future and promise? When to use core.async and when to use agents, future and promise? Thanks for help and 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/groups/opt_out.
Re: How to implement a distributed and concurrent system in Clojure?
Not that I'd recommend using it in production, but I experimented with distributed reference types on top of Redis some time ago: https://github.com/lantiga/exoref Several aspects are very rough e.g when the connection to Redis is lost or when it comes to reusing a key. Overall it's probably naive, but it may be a starting point. Luca On Thursday, July 4, 2013 11:39:46 AM UTC+2, David Pollak wrote: > > Please keep in mind that Scala's "Actor Model" is a very thin piece of > code that is not inherently distributed. > > There are a ton of issues in Scala related to crossing address spaces. > > Scala is not nearly as biased to immutability as Clojure. Sure, there are > case classes, but case classes can easily contain mutable data. When I > wrote Goat Rodeo (http://goatrodeo.org), I wrote a compiler plugin that > guaranteed immutability and serializability of the data structures used for > Goat Rodeo's Actor-based messaging... and this lead to the second issue... > > Having a class-based design means that one has to deal with > serializing/deserializing class-based data structures. This is a huge > problem. It means that the inter-process data structures must contain class > signatures... and for distributed systems that are going to have 100% > uptime, that means version and class signatures so that a message sent from > a version 1 system can be deserialized on a version 2 system even if the > class has changed. > > Long story short... Akka, the only popular distributed system in Scala, is > marginally better than RMI/J/EE, so for enterprise java shops, it's great > (much like Spring was.) But it's not something to aspire to. > > If I get some time, I'll work on a distributed version of core.async. The > only real challenge I can see is marshalling a Channel identifier across > address spaces. Everything else should be a walk in the park. > > > > > > > On Wed, Jul 3, 2013 at 5:26 PM, Hussein B. > > wrote: > >> Hi, >> >> I read recently on the internet that Clojure concurrency tools make it >> easy to implement a highly concurrent system but on a single machine. >> >> But how to implement a highly concurrent system that runs on a multiple >> machines? >> >> Erlang, Elixir and Scala have the Actors model. >> >> Please correct me if I'm wrong. >> >> Thanks for help and time. >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com . >> For more options, visit https://groups.google.com/groups/opt_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.