Re: Getting information from a hashmap that is inside anothe hashmap
You may use `get-in`. https://clojuredocs.org/clojure.core/get-in (get-in human2 [:char :eye-colour]) ;=> "red" Hope this helps. ~BG On Tue, Nov 22, 2016 at 4:12 PM, 'Rickesh Bedia' via Clojure <clojure@googlegroups.com> wrote: > Lets say I have: > (def human {:firstname "John" :surname "Smith"}) > To get the firstname I would run (human :firstname) and this would give > "John" > > However if I now have > (def human2 {:name "Bob" :char {:eye-colour "brown" :hair-colour > "red"}}) > how would I get the eye-colour? Would it be (human2 :char :eye-colour). I > just want the eye-colour > > Thanks 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/d/optout. -- Baishampayan Ghose b.ghose at gmail.com -- 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.
ANN: IN/Clojure 2016 - India's first Clojure conference
Hello Clojurists, I am delighted to announce IN/Clojure, India's first and only Clojure conference. It will be a one day, single track conference with interesting Clojure talks as well as ample opportunity to interact with fellow Clojurians from India and abroad. The conference is aimed at Clojure enthusiasts from all experience levels. The conference will be held on Nov 26, 2016 in Pune. More info on the website: http://inclojure.org/ Please follow us on Twitter: @in_clojure Thanks, BG -- Baishampayan Ghose b.ghose at gmail.com -- 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: Joy of Clojure : Backward running lisp ??
Running "backwards" here pertains to logic/relational programming in MiniKanren/core.logic style. Roughly here programs are expressed in terms of relations between the input and output. So given an input and an output query you'll run it forwards and by making the input itself a variable with a fixed output will generate a series of possible inputs, that'd be running it backwards. Useful for generating programs :-) Here is an example: http://jvns.ca/blog/2013/11/20/day-31-logic-programming-pretty-music/ ~BG On Thu, Jun 23, 2016 at 7:52 AM, Ashish Negi <thisismyidash...@gmail.com> wrote: > I am reading joy of clojure. In the "forward to second edition" William E > Byrd and Daniel P Firedman says : > > > > *As with recursion, the art of defining little languages encourages—and > rewards—wishful thinking. You might think to yourself, “If only I had a > language for expressing the rules for legal passwords for my login system.” > A more involved example—a story, really—started several years ago, when we > thought to ourselves, “If only we had the right relational language, we > could write a Lisp interpreter that runs backward.”[2] > <http://www-legacy.manning.com/fogus2/excerpt_foreword2ed.html#footnote-2> > What does this mean? * > > > *An interpreter can be thought of as a function that maps an input > expression, such as (+ 5 1), onto a value—in this case, 6. We wanted to > write an interpreter in the style of a relational database, in which either > the expression being interpreted or the value of that expression, or both, > can be treated as unknown variables. We can run the interpreter forward > using the query (interpret ‘(+ 5 1) x), which associates the query variable > x with the value 6. Better yet, we can run the interpreter backward with > the query (interpret x 6), which associates x with an infinite stream of > expressions that evaluate to 6, including (+ 5 1) and ((lambda (n) (* n 2)) > 3). (Brainteaser: determine the behavior of the query (interpret x x).)* > > Although the writer gave an example of `*(interpret x 6)*` i could not > imagine the use case of `*lisp interpreter running backwards*` ? > I am not even sure what he meant exactly. > > Thinking on it, i could only relate this to *theorem prover*s where you > run backwards from the result. > Can somebody explain this ? > > -- > 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. > -- Baishampayan Ghose b.ghose at gmail.com -- 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: Getting started
Saurabh, Thanks for your interest in Clojure. However, your question is quite open ended. Can you tell us what you have tried so far and if there is anything specific that you want us to help you with? Almost all the info that you'd need to get started can be found here: http://clojure.org/contributing Hope that helps. Regards, BG On Sun, Nov 1, 2015 at 7:01 PM, Saurabh Shah <shahsaurabh0...@gmail.com> wrote: > Hello, > > My name is Saurabh Shah and I am a second year undergraduate student at > DA-IICT, Gandhinagar, India. I have quite lately been contributing towards > the open source organizations and I find your organization the most > appropriate one to work on. > > > I request you to please guide me through the installation of your codebase > and how to get started to your organization. > > > Thanking You, > > Saurabh Shah. > > -- > 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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 do functional programming
Haha, Sean... you got me stumped there for a second. I completely agree with your assessment though. Dan Grossman's course on "Programming Languages" is an absolute blockbuster. Highly recommended! ~BG On Fri, Oct 9, 2015 at 5:49 AM, Sean Corfield <s...@corfield.org> wrote: > On 10/8/15, 1:32 PM, "Colin Yates" <clojure@googlegroups.com on behalf of > colin.ya...@gmail.com> wrote: > > >>This is a great course. I still get a bit green with envy when I recall the >>workbook capabilities in Eclipse. Another recommendation for Brian Marick’s >>OO to FP book. > > Ah, just realized this is Odersky’s course which is not what I was thinking > of! I really did NOT enjoy the progfun course. I found the exercises boring > and I found Scala itself fussy and annoying (and I _hate_ Eclipse!). And this > is from someone who did Scala in production for about 18 months before > switching to Clojure in 2011! > > The course I was thinking of, which I praised so highly was actually this one: > > https://www.coursera.org/course/proglang > > Programming Languages, University of Washington, Professor Dan Grossman. > > That’s the one I enjoyed so much I took it three times! > > It starts out with Standard ML to teach you about statically typed FP, then > it moves on to Racket to teach you about dynamically typed FP, then it wraps > up with Ruby to look at how dynamically typed OOP contrasts with the two FP > approaches. > > Sean > >> >>> On 8 Oct 2015, at 21:00, Sean Corfield <s...@corfield.org> wrote: >>> >>> On 10/8/15, 12:45 PM, "Raoul Duke" <clojure@googlegroups.com on behalf of >>> rao...@gmail.com> wrote: >>> >>> >>>> i did this one a while back as a refresher on my university stuff :-) >>>> https://www.coursera.org/course/progfun >>> >>> I’ll second this as a great recommendation. I first took the course several >>> years ago and I’ve taken it twice since as a Community TA — that’s how much >>> I like that course! :) >>> >>> It is switching from scheduled to on-demand so it won’t be available for a >>> while yet, but then folks will be able to take it whenever they want, at >>> their own speed. >>> >>> Sean > > > -- > 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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 don't support .clj source code file by utf-8.
Hi, IIRC Windows requires UTF-8 encoded files to have the BOM (Byte Order Mark). Can you verify that your file has the BOM? Regards, BG On Thu, Jul 9, 2015 at 8:03 AM, Alex Woods linpc...@gmail.com wrote: clojure don't support .clj source code file by utf-8. it's ok when the .clj source code files by ascii env: windows7,jdk1.8u45,lein2.5.0 -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: materials
Alex, I just realised my mistake. My apologies to the poster. Regards, BG On Thu, Jun 25, 2015 at 6:49 PM, Alex Miller a...@puredanger.com wrote: Hey BG, Perhaps the OP did Google already but saw too many choices and was looking for an informed decision about where to go first. Using a lmgtfy link is a condescending way to answer a question and I don't want this list or this community to be that kind of place. I would prefer people to respond to requests like this with a helpful pointer instead. We were all newbies once. Thanks, Alex On Thursday, June 25, 2015 at 4:10:46 AM UTC-5, Baishampayan Ghose wrote: http://lmgtfy.com/?q=clojure+tutorial Hope this helps. ~BG -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: materials
http://lmgtfy.com/?q=clojure+tutorial Hope this helps. ~BG On Thu, Jun 25, 2015 at 7:21 AM, Baskar Kalyanasamy baskar...@gmail.com wrote: hi everyone, can somebody send me materials for clojure. i am a beginner and i also want to in which tool or software i should practice in. thanks 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/d/optout. -- Baishampayan Ghose b.ghose at gmail.com -- 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] CIDER 0.9
By the way, I just tried connecting to two different repls from the same project (the regular one + one started by fighweel) and it made my Emacs hang :-\ Connecting to multiple repls on different projects works fine. Thanks, BG On Thu, Jun 18, 2015 at 5:26 PM, Bozhidar Batsov bozhi...@batsov.com wrote: Happy to hear this! :-) On 18 June 2015 at 14:36, Stefan Kamphausen ska2...@gmail.com wrote: Dear CIDER Devs, On Tuesday, June 16, 2015 at 4:33:48 PM UTC+2, Bozhidar Batsov wrote: CIDER 0.9 is finally out! You can read more about the release here http://batsov.com/articles/2015/06/16/cider-0-dot-9/ thanks for the time and effort you've put into this! Works fine for me. Update issues were totally minor so far. Fixing them probably took less time than Eclipse needs to download the update information, let alone calculating dependencies. :-P Cheers, stefan -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: Get anonymous function's(which is parameter to function) body in called function
Shalaka, This is a really interesting conversation :-) However, I'd insist that you ditch eval or any sort of complicated affair and adopt the metadata approach as I had suggested that day :-P ~BG On Fri, May 29, 2015 at 4:20 PM, Shalaka Patil shal...@helpshift.com wrote: Hey, Thanks Herwig Mohit. So, I have one more solution. Here is the original wait-until function- (defn wait-until ([pred] (wait/wait-until *driver* (fn [_] pred))) ([pred timeout] (wait /wait-until *driver* (fn [_] pred) timeout)) ([pred timeout interval] ( wait/wait-until *driver* (fn [_] pred) timeout interval)) ([driver pred timeout interval] (wait/wait-until driver (fn [d] (pred d)) timeout interval))) I have converted function to macro like - (defmacro with-wait-until-error-log [pred body] `(try ~@body (catch Exception e# (println \nWait-until failed for: ~pred \n) e#))) (defmacro wait-until [ args] `(if (= (count '~args) 4) (let [pred# (nth '~args 1)] (with-wait-until-error-log pred# (wait/wait-until (eval (nth '~args 0)) (fn [_#] (eval pred#)) (nth '~args 2) (nth '~args 3 (let [pred# (first '~args)] (with-wait-until-error-log pred# (wait/wait-until *driver* (fn [_#] (eval pred#)) (nth '~args 1) (nth '~args 2)) So, by this way I am not breaking input format or fn behaviour, but need to use `eval`. So, is there any other way for doing same as eval? Or, is it OK to use eval? On Friday, May 29, 2015 at 12:55:20 PM UTC+5:30, Mohit Thatte wrote: I see what you mean, this is nice On Thu, May 28, 2015 at 11:25 PM, Herwig Hochleitner hhochl...@gmail.com wrote: 2015-05-28 19:42 GMT+02:00 Mohit Thatte mohit@gmail.com: The interesting question here is what constitutes useful information! (let [pred #(exists? .foo)] (wait-until pred)) ;; - the fact that it's called 'pred is not interesting in most cases The trade-off is breaking an existing public API. How so? (defmacro op [msg args expr] `(with-meta (fn ~args ~expr) {:msg ~msg :args '~args :expr '~expr})) (let [pred1 #(exists? .foo) pred2 (op checks existance [] (exists? .foo))] ;; both these will work, the one with pred1 will give less useful errors. the API of wait-until is unchanged (wait-until pred1) (wait-until pred2)) If Shalaka's primary goal is prettier errors in test failures, I'd settle for the fn body itself as the error message and that could be achieved without breaking the API. The op macro can include the code in its information. -- 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/d/optout. -- -Mohit Thatte -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: Get anonymous function's(which is parameter to function) body in called function
May be wrap it up in a `wait-until-with-meta` macro as Herwig suggested? Then you can search and replace the invocations. ~BG On Fri, May 29, 2015 at 9:30 PM, Shalaka Patil shal...@helpshift.com wrote: Hey BG, Yes, having metadata is really a straight forward way but this is kind of extra work in every wait-until call which I was trying to avoid. Going with metadata option will not just cause extra work for wait-until in future code but even I need to add it at all the places in wherever it is used. But yes, if having `eval` is really bad way or there is no other way to handle it then will go with `metadata` approach :) On Friday, May 29, 2015 at 8:53:11 PM UTC+5:30, Baishampayan Ghose wrote: Shalaka, This is a really interesting conversation :-) However, I'd insist that you ditch eval or any sort of complicated affair and adopt the metadata approach as I had suggested that day :-P ~BG On Fri, May 29, 2015 at 4:20 PM, Shalaka Patil sha...@helpshift.com wrote: Hey, Thanks Herwig Mohit. So, I have one more solution. Here is the original wait-until function- (defn wait-until ([pred] (wait/wait-until *driver* (fn [_] pred))) ([pred timeout] ( wait/wait-until *driver* (fn [_] pred) timeout)) ([pred timeout interval] (wait/wait-until *driver* (fn [_] pred) timeout interval)) ([driver pred timeout interval] (wait/wait-until driver (fn [d] (pred d)) timeout interval))) I have converted function to macro like - (defmacro with-wait-until-error-log [pred body] `(try ~@body (catch Exception e# (println \nWait-until failed for: ~pred \n) e#))) (defmacro wait-until [ args] `(if (= (count '~args) 4) (let [pred# (nth '~args 1)] (with-wait-until-error-log pred# (wait/wait-until (eval (nth '~args 0)) (fn [_#] (eval pred#)) (nth '~args 2) (nth '~args 3 (let [pred# (first '~args)] (with-wait-until-error-log pred# (wait/wait-until *driver* (fn [_#] (eval pred#)) (nth '~args 1) (nth '~args 2)) So, by this way I am not breaking input format or fn behaviour, but need to use `eval`. So, is there any other way for doing same as eval? Or, is it OK to use eval? On Friday, May 29, 2015 at 12:55:20 PM UTC+5:30, Mohit Thatte wrote: I see what you mean, this is nice On Thu, May 28, 2015 at 11:25 PM, Herwig Hochleitner hhochl...@gmail.com wrote: 2015-05-28 19:42 GMT+02:00 Mohit Thatte mohit@gmail.com: The interesting question here is what constitutes useful information! (let [pred #(exists? .foo)] (wait-until pred)) ;; - the fact that it's called 'pred is not interesting in most cases The trade-off is breaking an existing public API. How so? (defmacro op [msg args expr] `(with-meta (fn ~args ~expr) {:msg ~msg :args '~args :expr '~expr})) (let [pred1 #(exists? .foo) pred2 (op checks existance [] (exists? .foo))] ;; both these will work, the one with pred1 will give less useful errors. the API of wait-until is unchanged (wait-until pred1) (wait-until pred2)) If Shalaka's primary goal is prettier errors in test failures, I'd settle for the fn body itself as the error message and that could be achieved without breaking the API. The op macro can include the code in its information. -- 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/d/optout. -- -Mohit Thatte -- 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/d/optout. -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google
Re: ANN: Prone - better exception reporting middleware for Ring
This is brilliant! Thanks Magnar :-) ~BG On Mon, Dec 8, 2014 at 1:15 PM, Magnar Sveen magn...@gmail.com wrote: Better exception reporting middleware for Ring. Heavily inspired by better_errors for Rails https://github.com/charliesome/better_errors. See it to believe it: a quick video demoing Prone https://dl.dropboxusercontent.com/u/3378230/prone-demo.mp4. Prone presents your stack traces in a consumable form. It filters out stack frames that did not originate in your application, allowing you to focus on your code. It allows you to browse environment data, such as the request map and exception data (when using ex-info). Prone also provides a debug function that enables you to visually browse local bindings and any piece of data you pass to debug. https://github.com/magnars/prone/blob/master/screenshot.png Check it out: https://github.com/magnars/prone Any feedback welcome. :-) -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: Optimizing code : Fun but now paining me
Can you still tell me what the problem statement is? I saw some mutation in the earlier code, may be it was for testing. ~BG On Tue, Oct 14, 2014 at 6:25 PM, Ashish Negi thisismyidash...@gmail.com wrote: @BG Glad to know i am interacting with you :) Of course i understand that you are not criticizing me.. I have refactored my code and have made a gist.. that may help.. I have put some comments. https://gist.github.com/ashishnegi/a9ae3fb3c270c7d3742e please share your comments on that. I am really hoping about finding performance points there. Also for indentation, 1. i am using paredit and emacs and it was doing the usual good steps. i even tried with 1. C-x h and C-M-/ 2. M-q 3. C-M-q .. but not much difference. What do you use for auto indentation ? I think that my code do not have any mutation. But may be i was doing something wrong. Can you tell where was i mutating ? ** I hope that one understands that i am participating in competitive programming so usually things like code indentation and variable naming take a back seat.. but definitely that is not acceptable. -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: Optimizing code : Fun but now paining me
22 * 79 - 21) (= 12 (int (first (Expression (make-calulator-list 4/2/2 + 8) (= 4 (int (first (Expression (make-calulator-list 4/-2/2 + 8) (= 98605 (int (mod (first (Expression (make-calulator-list 55+3-45*33-25))) ToMod))) (= 99987 (int (mod (first (Expression (make-calulator-list 4/-2/(2+8 ToMod))) (= 22 (int (first (Expression (make-calulator-list (22)*+1/-1+(1)) (= 22 (int (first (Expression (make-calulator-list 11*(2/2)*2) (= 11 (int (first (Expression (make-calulator-list 22*2/2*2) (= '(4 / - 2 / 2 + 8) (make-calulator-list 4/-2/2 + 8)) (= '(4 / - 2 / ( 2 + 8 )) (make-calulator-list 4/-2/(2 + 8))) ) ) (RunTests) (Expression '(3 + 2)) (conj '(3) 1) (cons 2333 '(2 3 4)) (cons 2 (drop 1 '())) (drop 1 '()) (str (int 1.0)) (cons 1 '(1 3)) (cons 1 nil) (int (Integer. 1)) (int (mod (first (Expression (make-calulator-list 4/-2/(2+8 ToMod)) (mod (first (Expression (make-calulator-list 4/2))) ToMod) (defn diffTime [func args] (let [start (.getTime (java.util.Date.)) res (apply func args) end (.getTime (java.util.Date.))] (- end start))) (defn somuchtime= [times] (let [start (java.util.Date.) ] (loop [iTime 0] (if (= iTime times) start (recur (inc iTime)) (defn GenerateCalculatorTests [nums] (loop [num 0 sb (StringBuilder.)] (if (= num nums) (str 1 (.toString sb)) (- sb ((fn [sb] (let [r (rand-int 500)] (do (if ( r 100) (.append sb +) (if ( r 200) (.append sb -) (if ( r 300) (.append sb *) (if ( r 497) (.append sb /) (.append sb (str *( (GenerateCalculatorTests 4) )+)) (.append sb (rand-int 10)) sb (recur (inc num)) )) ) ) (GenerateCalculatorTests 50) (defn Execute [num] (let [str (GenerateCalculatorTests num)] (do (println str = ) (Expression (make-calulator-list (GenerateCalculatorTests num)) (diffTime Execute 2074) I find that the last problem which is giving runtime error is may be StackOverflow as i get it in with (diffTime Execute 3000) ;; where 3000 tries to get a calculator expression of 3000 or more ints.. see GenerateCalculatorTests.. with diffTime i also found that using rem is faster than using mod.. -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: Optimizing code : Fun but now paining me
The size of the code doesn't matter, I have read much larger code-bases in less than 10 mins. Your code is unreadable because of weird naming of locals, completely absurd indentation, use of mutation, etc. It's just too much work to interpret the code. I think it will be better if you share the problem instead and the experts here can show you how it's done. Again, please understand that I am merely criticising your code and not you. As a matter of fact I appreciate your efforts. ~BG On Tue, Oct 14, 2014 at 1:32 PM, Ashish Negi thisismyidash...@gmail.com wrote: @Baishampayan Ghose You caught me right.. i am a novice in clojure.. But most of my functions are smaller ( upto problem requirement ) and self containing.. so i think that you might be having issues with some particular function.. If that is so.. i can put some comments and refactor that part. and i am participating in coding competition and i think performance matters to me at this point. I hope that you were not commenting about the last message post as most of it was time stamps printed on 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: this way to remove map is ok?
Atoms are not coordinated, so you need to use refs here: (def map-1 (ref {})) (def map-2 (ref {})) (defn change [key1 key2 ] (dosync (alter map-1 dissoc key1) (alter map-2 dissoc key2))) Depending on your problem you might consider using just one ref instead of two as well (in that case, an atom should be fine). ~BG On Wed, Jul 16, 2014 at 8:41 AM, zhenxuanpan zhenxuan...@gmail.com wrote: (def map-1 (atom {})) (def map-2 (atom {})) (defn change [key1 key2 ] (dosync (swap! map-1 dissoc key1) (swap! map-2 dissoc key2) ) ) is this way ok ? -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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] 1st public release of thi.ng geometry toolkit (CLJ CLJS)
Brilliant work. Major kudos for writing a literate program. ~BG On Tue, Mar 11, 2014 at 3:02 AM, Karsten Schmidt toxmeis...@gmail.com wrote: It is my absolute pleasure to finally announce the first public release of the 2d/3d geometry library/toolkit: thi.ng/geom Having worked on this regularly since late 2011 as successor of my Java-based toxiclibs.org project, the new project has already undergone three complete overhauls as I've been improving my grasp of Clojure. The project currently consists of 26 namespaces and 6500+ lines of code. You can find all existing details, sources initial examples at: https://github.com/thi-ng/geom/blob/master/src/index.org Leiningen coords: [thi.ng/geom 0.2.0] (available from Clojars) This project is part of a bigger rapidly growing collection of Clojure libraries targeted at the wider computational/generative design context. All libraries in the thi.ng collection are (will be) developed in a literal programming format to also encourage their use in teaching contexts and generally try to improve the state of documentation managing source code. Clojure with its focus on isolated functionality is particular nice to work with in this sense and Org-mode has completely transformed my way of working. Since this is only the 1st release and I've planned a few more (potentially) breaking API changes I cannot currently accept major pull requests until the API is more solid (and once I'm less up against deadlines). In general though, I hope this project has a wide enough scope license to encourage further communal development. Lastly, if you're not too allergic to strong German accents, you can also watch (and follow along) a little live coding session I've done with Paul Kinlan @ Google Developers Live last month: http://youtu.be/tKIVJ2TaS2k?t=20m9s Happy coding! :) -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- 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: Best Informatica Online Training By Vast IT Expert trainers in Hyderabad | India | UK| USA
Please don't send spam to our mailing list. Thank you. ~BG On Fri, Jan 17, 2014 at 2:59 PM, Sairam Shankar sairamshanka...@gmail.com wrote: Informatica Online Training by Sunitlabs We are providing excellent Informatica Training by real-time IT industry experts Our training methodology is very unique Our Course Content covers all the in- depth critical scenarios. We have completed more than 200 Informatica batches through Online Informatica Training program, Our Informatica Classes covers all the real time scenarios, and its completely on Hands- on for each and every session. Please call us for the Demo Classes we have regular batches and weekend batches. Contact Number : India :+91 9030928000, Email : i...@sunitlabs.com , Web: http://sunitlabs.com/informatica-online-training/ -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Can't remember the name of that plugin
Kibit https://github.com/jonase/kibit ~BG On Sat, Jan 11, 2014 at 7:39 PM, Robin Heggelund Hansen skinney...@gmail.com wrote: Hi! Just looked at the eastwood lint today, awesome project. It reminded me of another clojure plugin which analyzes your code and tells you how it could be written more idiomaticly. I can't remember the name of this plugin, does anyone know? -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: New release of Light Table (which is now open source!)
LightTable is indeed, a remarkable piece of software. Really shows what ClojureScript is capable of. The code is very beautiful too. Congratulations, Chris! ~BG On Wed, Jan 8, 2014 at 11:49 PM, Chris Granger ibdk...@gmail.com wrote: Hey Folks, We did a big release today which includes a lot of love for Clojure! We also released all the source to Light Table, which has to be one of the largest full ClojureScript applications out there. To read more about all the goodness check out my blog post: http://www.chris-granger.com/2014/01/07/light-table-is-open-source/ And take a look at the source here: https://github.com/lighttable Cheers, Chris. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Quick library status updates (logging, Redis, i18n, etc.)
Fantastic stuff, Peter. Your projects are extremely useful, well designed and have great docs. Your work is really inspiring. ~BG Sent from phone. Please excuse brevity. On 4 Dec 2013 23:00, Peter Taoussanis ptaoussa...@gmail.com wrote: Hi all, quick batched update on some libs that I'm maintaining: *Timbre - v3.0.0-RC2 - 2013-12-04* == Logging profiling tools Major recent changes: * Carmine (Redis) appender that serializes log entries to length-limited, rotating lists by log level. Allows easy querying+manipulation of log as a Clojure value: the log is just a vector of ordered maps. Works great with Datomic's query engine, or regular seq fns (filter, group-by, sort-by, etc.). * Support for ad hoc logging config - no longer reliant on a global config atom (though it's still there for convenience). * Appender rate limiter has been made a lot more flexible, useful by default. https://github.com/ptaoussanis/timbre https://github.com/ptaoussanis/timbre/blob/master/CHANGELOG.md http://ptaoussanis.github.io/timbre/ - API docs *Carmine v2.4.0 - 2013-11-18* === Redis client message queue Major recent changes: * Completely rewrote message queue system - numerous big improvements, incl. important reliability improvements. * Completely rewrote reply parsing system for robustness + flexibility. * Brought Tundra out of alpha, added S3 datastore. Allows automatic data replication to a secondary data store, and an option to automatically evict cold keys from memory. Basically provides a convenient way of running Redis against much larger datasets than can fit in memory. * Big improvements to atomic operations API - everything has been unified behind a single interface. * A ton of other small improvements, including bug fixes. https://github.com/ptaoussanis/carmine https://github.com/ptaoussanis/carmine/blob/master/CHANGELOG.md http://ptaoussanis.github.io/carmine/ - API docs *Nippy v2.5.1 - 2013-12-04* = Extendable, high-performance, binary serialization Major recent changes: * Continued performance work. Think it's ballpark about as fast as it's going to get. * LZMA2 very-high-compression compressor (ahem). * New Java Serializable fallback support. Basically serializes anything you can throw at it - will select the best available method. Notably Throwables of all types are now covered. https://github.com/ptaoussanis/nippy https://github.com/ptaoussanis/nippy/blob/master/CHANGELOG.md http://ptaoussanis.github.io/nippy/ - API docs *Tower v2.0.1 - 2013-11-06* = Internationalisation (i18n) and localisation (L10n) tools Major recent changes: * Stable. https://github.com/ptaoussanis/tower https://github.com/ptaoussanis/tower/blob/master/CHANGELOG.md http://ptaoussanis.github.io/tower/ - API docs *Faraday v1.0.1 - 2013-12-04* == Amazon DynamoDB client Major recent changes: * Went 1.0, production-ready. https://github.com/ptaoussanis/faraday https://github.com/ptaoussanis/faraday/blob/master/CHANGELOG.md http://ptaoussanis.github.io/faraday/ - API docs *Touchstone v2.0.1 - 2013-11-25* = High performance, rapidly converging A/B testing tool Major recent changes: * Stable. https://github.com/ptaoussanis/touchstone https://github.com/ptaoussanis/touchstone/blob/master/CHANGELOG.md http://ptaoussanis.github.io/touchstone/ - API docs *General status* Tower still requires Clourescript dictionary support - hope to find some time to look into that in the coming weeks. Carmine's got a bunch of changes coming up to support Redis Cluster Sentinel - though I'm waiting on the specs there to get finalised first. Everything else should (hopefully) stay more or less stable from here (modulo bugs). Carmine's in good shape as of v2.4. Timbre's in good shape as of v3, though the RC will need some time to settle before I'm confident it's good for production. Ahh- yeah, nothing else I can think of. Hit me up if you have any questions/problems/wanna-say-hi/whatever. Cheers! :-) -- *Peter Taoussanis*ptaoussanis at gmail.com https://twitter.com/ptaoussanis -- -- 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
Re: ANN: Clojure High Performance Programming
The ToC looks amazing. Great work, Shantanu! ~BG On Thu, Nov 21, 2013 at 5:21 AM, Shantanu Kumar kumar.shant...@gmail.com wrote: Hi, I am pleased to announce availability of the book `Clojure High Performance Programming` that I have been writing for the better part of this year: http://www.packtpub.com/clojure-high-performance-programming/book This book is ideally meant for intermediate Clojure programmers. It is divided into seven chapters covering Clojure abstractions, Java interop, JVM internals, Concurrency and other performance-related topics. Shantanu -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Releasing Caribou today: Open Source Clojure Web Ecosystem
This is brilliant! Many thanks Ryan. Looking forward to trying these out and contributing back. ~BG On Wed, Nov 13, 2013 at 5:22 AM, Ryan Spangler ryan.spang...@gmail.com wrote: Hello Clojure, Excited to announce today the release of Caribou! http://let-caribou.in/ We have been building web sites and web applications with it for over two years now and improving it every day. Currently we have four people working on it and another ten using it to build things, so it is getting a lot of real world testing. It has been designed as a collection of independent libraries that could each be useful on their own, but which come together as a meaningful whole. We have been spending the last couple months getting it ready for a full open source release, and I am happy to say it is finally ready. Funded and supported by Instrument in Portland, OR: http://weareinstrument.com/ We have four projects using it in production, and several more about to be launched (as well as over a dozen internal things). Documentation is here: http://caribou.github.io/caribou/docs/outline.html Source is here: http://github.com/caribou/caribou (use this for issues, you don't actually need the source as it is installed through a lein template). Some of the independently useful libraries Caribou is built on are: * Polaris -- Routing with data (not macros) and reverse routing! : https://github.com/caribou/polaris * Lichen -- Image resizing to and from s3 or on disk: https://github.com/caribou/lichen * Schmetterling -- Debugging Clojure processes from the browser: https://github.com/prismofeverything/schmetterling * Antlers -- Useful extensions to mustache templating (helpers and blocks, among other things): https://github.com/caribou/antlers * Groundhog -- Replay http requests: https://github.com/noisesmith/groundhog And many others. Basically this is an Alpha release, and I am announcing it here first in order to get as much feedback from the community as possible. We have made it as useful as we can for our purposes and recognize that for it to improve from here, we really need as many people using it and building things with it as possible. The documentation also needs to be put through its paces: we need to see how well people are able to use it who know nothing about it, based only on the existing docs. All feedback welcome! Thanks for reading! I hope you find it useful. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: road map for clojure?
Please don't judge activity of a programming language ecosystem by just looking at the frequency of commits in the main language. Clojure the language evolves relatively slowly and every new feature is added after a lot of careful design. Unlike most mainstream languages many important features of Clojure are developed as libraries, eg. core.async, core.typed, core.logic, etc. Clojure is a very actively used and developed [with] language with a vibrant community. If you want to look at any superficial metric at all, then you may look at the frequency quality of posts made on this list as a key indicator. ~BG On Thu, Oct 31, 2013 at 4:32 AM, julius wee@gmail.com wrote: Hi, Is clojure under dev? there is no much commits in months, any plan or road map for clojure? thanks -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: .length vs. count for string length
What'd clojure.string/len do any differently than clojure.core/count? count already provides does the fastest possible thing for strings. ~BG On Wed, Oct 30, 2013 at 4:14 PM, Alice dofflt...@gmail.com wrote: Which one is preferred? .length needs to be type hinted, so more verbose. The performance penalty of count is negligible in most cases. I think including len in clojure.string would be a good idea because it's used so often. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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] ribol 0.3.1 - conditional restarts - api stablized, docs updated.
This is fantastic, Chris. Many thanks! ~BG On Tue, Oct 1, 2013 at 12:49 PM, Chris Zheng z...@caudate.me wrote: Dima and BG, A new version is up with implementation details - http://z.caudate.me/ribol/#implementation as well as the requested stacktrace … although I called it :origin instead of :stacktrace. - http://z.caudate.me/ribol/#raise-on Chris -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Curious behaviour of 'frequencies'
The second one is actually a PersistentArrayMap and hence properties that might indicate (falsely) that it's a sorted-map (aka PersistentTreeMap). Clojure uses PersistentArrayMap for small maps as an optimisation and automatically promotes to PersistentHashMap when the number of items crosses a certain threshold (32, IIRC). Regards, BG On Mon, Sep 30, 2013 at 3:54 PM, Gavin Sinclair gsincl...@gmail.com wrote: I have a value 'y' in my REPL that is a sequence containing two sequences of numbers: (def y '( (15 18 17 17 16 19 16 10 21 16 21 23 19 16 18 15 21 14 21 12 26 17 13 22 26 16 14 17 11 15 16 18 13 10 18 18 19 13 14 17 19 18 15 20 20 17 20 19 12 20 14 21 13 17 15 22 17 21 13 15 16 17 14 21 14 15 17 16 25 22 13 19 23 20 16 16 17 13 15 19 20 14 15 17 13 17 11 17 16 20 16 20 15 14 13 18 18 17 15 16 15 18 28 12 20 16 17 22 20 23 15 16 21 24 18 18 18 18 14 18 21 15 12 19 19 16 12 15 21 19 18 17 16 17 16 18 18 12 18 18 17 20 21 15 20 19 19 15 21 17 13 18 11 19 18 21 17 23 15 16 17 17 15 17 17 15 15 14 19 18 18 14 17 14 18 25 24 11 20 15 13 20 18 16 20 20 16 16 18 15 18 22 18) (24 18 20 17 19 19 20) )) When I ask for the frequencies of the two sequences, one is a sorted map and the other is unsorted. = (keys (frequencies (first y))) (10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 28) = (keys (frequencies (second y))) (24 18 20 17 19) The classes of the maps don't indicate that the first map is indeed sorted, but it cannot be a coincidence that they keys are returned in order. (I tried it with some more data concatenated and it was still in order.) The source for 'frequencies' (version 1.5.1) does not reveal to me why I get sorted in one case and unsorted in the other. It must be to do with the length of the sequence, but what is the full explanation? Thanks, Gavin -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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] ribol 0.3.1 - conditional restarts - api stablized, docs updated.
Hi Chris, If you get the time, could you also write about the architecture of ribol, its implementation details, etc. too? That'd be immensely useful. ~BG On Mon, Sep 30, 2013 at 4:16 PM, zcaudate z...@caudate.me wrote: Thanks everybody for your feedback and suggestions on the last post. Version 0.3.1 has the following updates: The `finally` clause is supported on `manage` - http://z.caudate.me/ribol/#finally as well as all the hook forms - http://z.caudate.me/ribol/#hooks `raise-on` and `raise-on-all` have been updated to work better with thrown clojure.lang.ExceptionInfo objects I've also put in a section on how code can be reused using restarts - http://z.caudate.me/ribol/#unlucky-numbers -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Curious behaviour of 'frequencies'
Thanks for the correction, Shantanu. It's indeed 8, I was not sure of 32 anyway. ~BG On Mon, Sep 30, 2013 at 4:26 PM, Shantanu Kumar kumar.shant...@gmail.com wrote: Hi Gavin and BG, On Monday, 30 September 2013 16:06:45 UTC+5:30, Baishampayan Ghose wrote: The second one is actually a PersistentArrayMap and hence properties that might indicate (falsely) that it's a sorted-map (aka PersistentTreeMap). Clojure uses PersistentArrayMap for small maps as an optimisation and automatically promotes to PersistentHashMap when the number of items crosses a certain threshold (32, IIRC). Nitpic: I have noticed array map is up to 8 pairs. Shantanu -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Emacs font and theme for clojure
I use Source Code Pro[1] with tomorrow-theme[2]. ~BG [1] http://blogs.adobe.com/typblography/2012/09/source-code-pro.html [2] https://github.com/chriskempson/tomorrow-theme On Thu, Sep 26, 2013 at 8:21 PM, Murtaza Husain murtaza.hus...@sevenolives.com wrote: Hi, I was just cycling through the different themes in emacs. I was wondering what font and theme combination others are using ? Any recommendations for mac pro retina ? I like the solarized-dark theme, however the default font doesnt seem very good with it. Thanks, Murtaza -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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] ribol v0.2.1 - comprehensive document on conditional restart systems
This is brilliant, thanks! ~BG On Wed, Sep 25, 2013 at 12:44 PM, zcaudate z...@caudate.me wrote: I've done a pretty comprehensive guide on conditional restart systems in clojure with diagrams to show why it is much more flexible over try/catch mechanism Project: https://github.com/zcaudate/ribol Generated Documentation: http://z.caudate.me/ribol/ -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Selecting subsets of maps
Alex, Very cool! Thanks. ~BG On Fri, Aug 30, 2013 at 4:58 PM, Alex P oleksandr.pet...@gmail.com wrote: @ Baishampayan @ Christophe Accidentally crossed over this post, turned out I've had exactly same need (about a year after you though), and decided to write a little library, Balagan: https://github.com/clojurewerkz/balagan Basically, you can run predicate-based queries on your data and apply transformations. Check it out, maybe it helps On Tuesday, May 29, 2012 2:23:30 PM UTC+2, Baishampayan Ghose wrote: Great feedback, Christophe. I will get back to you with a better implementation. Regards, BG On Tue, May 29, 2012 at 5:44 PM, Christophe Grand chris...@cgrand.net wrote: The expansion idea is interesting: expand your selectors to a seq of paths, redcue with get-in/assoc-in over thme to get the extract sense, reduce with update-in+dissoc to get the exclude. Could yield a nice implementation. And now for some nitpicking: * nowadays I'm reluctant to extend a protocol to interfaces * apply where reduce should be used (L15) * what's the puprose of (juxt key val)? (L20) Christophe On Tue, May 29, 2012 at 12:37 PM, Baishampayan Ghose b.g...@gmail.com wrote: Christophe, Laurent dragged me in the conversation so here is my take https://gist.github.com/2823916 which strictly follows your proposed syntax. I am glad that Laurent dragged you in, I got to see your beautiful solution :-) Here is my (less beautiful) solution, `extract` along with its counterpart `exclude` which does the opposite - https://www.refheap.com/paste/2911 Comments welcome. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- 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 -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.cgrand.net/ (en) -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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 Introducing Route One
Curious, how does it differ from Clout? ~BG On Tue, Aug 13, 2013 at 9:38 PM, Michael Klishin michael.s.klis...@gmail.com wrote: On behalf of the ClojureWerkz team, I'm happy to announce our not-so-new project that has recently reached 1.0.0-rc1 stage: Route One [1]. Route One is a route generation library complimentary to Clout, part of Compojure. It takes a route definition and parameters and produces a URL/URI/path. It can be used in any application that may need to generate URLs/URIs/paths. 1.0.0-rc1 release notes: http://blog.clojurewerkz.org/blog/2013/08/12/route-one-1-dot-0-0-rc1-is-released/ Documentation and examples: https://github.com/clojurewerkz/route-one#documentation--examples 1. http://github.com/clojurewerkz/route-one -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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 Introducing Route One
That's clearer, thanks! ~BG On Tue, Aug 13, 2013 at 11:51 PM, Oleksandr Petrov oleksandr.pet...@gmail.com wrote: It actually doesn't do anything Clout does. Latest modifications actually make it 100% complementary to clout, so now you can do: (defroute about /about) (defroute documents /docs/:title) (compojure/defroutes main-routes (compojure/GET about-template request (handlers.root/root-page request)) ;; will use /about as a template (compojure/GET documents-template request (handlers.root/documents-page request)) ;; will use /documents as a template (route/not-found Page not found)) Meaning that on Route One side you specify the way you generate url from parts, and clout takes same template and makes urls parseable. To sum it up: Clout only does route recognition (URL = route), while Route One does only URL generation (route = URL) Thanks! On Tue, Aug 13, 2013 at 7:12 PM, Baishampayan Ghose b.gh...@gmail.com wrote: Curious, how does it differ from Clout? ~BG On Tue, Aug 13, 2013 at 9:38 PM, Michael Klishin michael.s.klis...@gmail.com wrote: On behalf of the ClojureWerkz team, I'm happy to announce our not-so-new project that has recently reached 1.0.0-rc1 stage: Route One [1]. Route One is a route generation library complimentary to Clout, part of Compojure. It takes a route definition and parameters and produces a URL/URI/path. It can be used in any application that may need to generate URLs/URIs/paths. 1.0.0-rc1 release notes: http://blog.clojurewerkz.org/blog/2013/08/12/route-one-1-dot-0-0-rc1-is-released/ Documentation and examples: https://github.com/clojurewerkz/route-one#documentation--examples 1. http://github.com/clojurewerkz/route-one -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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. -- alex p -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Wrong documentation of contains?
Hi, `contains?` only works with associative data-structures like maps vectors. If you want to find out if a sequence contains a specific object then you need to use `some` paired with a set as a predicate. For example: (some #{3} '(1 2 3 4)) Hope this helps. ~BG On Wed, Aug 7, 2013 at 4:54 PM, Goldritter marcus.goldritter.lind...@gmail.com wrote: In an program I used the result of keys as an argument for a function which verifies whether an object is in a passed collection or not. The result I got was following Exception: IllegalArgumentException contains? not supported on type: clojure.lang.APersistentMap$KeySeq clojure.lang.RT.contains (RT.java:724) What are the reasons behind this Exception? In the documentation of contains? it is written, that Returns true if key is present in the given collection, otherwise returns false. The examples on this page (http://clojuredocs.org/clojure_core/clojure.core/contains_q) and the parameter description indicates, that contains? accept any collection as argument. The result of keys is also a collection = (coll? (keys {:a f :b 23})) true So is this a bug or is there a reason behind the fact, that contains? does not accept any collection? Or is the documentation wrong and it should nor be a collection as argument but a set or a vector? Because I get the same Exception for a list, but not for a vector. The same for lists, which returns also true for coll?. = (coll? '(1 2 3 4)) true = (contains? '(1 2 3 4) 3) IllegalArgumentException contains? not supported on type: clojure.lang.PersistentList clojure.lang.RT.contains (RT.java:724) = (contains? [1 2 3 4] 3) true -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Idiomatic use of records?
The second form in both the cases. The first ones IMHO are implementation detail. ~BG On Thu, Jul 25, 2013 at 9:48 PM, Sean Corfield seancorfi...@gmail.com wrote: I tend to use plain ol' maps for data structures but was showing someone defrecord the other day and had some questions about idiomatic usage: Given: (defrecord Point [x y]) Which constructor form is considered more idiomatic: (Point. 10 10) or (-Point 10 10) Which accessor form is considered more idiomatic (assume pt is a Point record): (.x pt) or (:x pt) Are there (other) things regarding records for which idiomatic usage would not look just like maps? -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Can we please deprecate the :use directive ?
Lee, For that use-case, you can always use something like (:require the-ns :refer :all). Regards, BG On Wed, Jul 24, 2013 at 1:27 AM, Lee Spector lspec...@hampshire.edu wrote: On Jul 23, 2013, at 3:06 PM, Gary Trakhman wrote: Yea, I have a single namespace with project-specific common utilities which I refer to as u/some-util-function. For me, it's a bit scary to have implicit symbols in scope. A typo can make a local binding refer to something that might not exist in production, or at least not what's intended. Conversely, I don't want extra code in my project that has nothing to do with the project. Seems useful to enforce a separation of the artifact from the tools that made it, more-so for a lib that other things depend on than a production app. The 'user' namespace can cover the use-case of convenience functions? Or, you can add those symbols dynamically at run-time when you need to with something like: https://github.com/flatland/useful/blob/develop/src/flatland/useful/ns.clj#L26 or some aggregated (require ..) calls. I'm sure I'm coming from a minority perspective on this, but for the kind of work I do it's often more important to be able to quickly sketch out and test ideas, without any ceremony about which functions come from where, than it is to ensure safety in a production environment which is really just me running it right now. In fact I'd sometimes like to go the other way and use everything in a whole directory subtree, or even to get rid of using altogether and have the runtime system find the function wherever it can (within reason :-) and let me know if it can't or if there's a conflict. I do understand that there are a great many programming contexts in which it would be foolish and dangerous to manage references so loosely and implicitly and dynamically. In fact it's a bad idea in some of my work too, so I'm slightly more disciplined than this some of the time. But my point is just that different users will have different priorities, and from where I sit, at least, it'd be nice to keep :use. -Lee -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: anaphoric macro?
Since the bindings are a function of the data that's passed in, IMO you don't need a anaphoric macro for this. For example - (defmacro def-names [names body] (let [bindings* (vec (mapcat (juxt symbol identity) names))] `(let ~bindings* ~@body))) As to whether it's a good idea or not, I'd say it depends but YMMV. Regards, BG On Tue, Jul 23, 2013 at 12:48 PM, eliassona...@yahoo.com wrote: Hi, I want to write a macro that introduces new variables from data. The data is a vector and looks like this for example: [a b c] I want to use the macro like this: (def-names [a b c] (str a b)) What code I want the macro to produce from the above is the following: (let [a a b b c c] (str a b)) Is it possible to do that? Is it a good thing to do that or is it bad practice? Thanks --anders -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: futures - The Joy Of Clojure book question
It's definitely got to do with the code, the right way to test it out will be to wrap the form in a function and then calling it twice. Like so - (time (let [x (fn [] (Thread/sleep 2000) (+ 1 1))] [(x) (x)])) ;= Elapsed time: 4002.0 msecs ;= [2 2] Hope that helps. Regards, BG On Tue, Jul 23, 2013 at 8:34 PM, Ryan Moore niclas1...@gmail.com wrote: There is an example in the book The Joy of Clojure on p.262 that uses futures that I evaluated in the REPL. user (time (let [x (future (do (Thread/sleep 2000) (+ 1 1)))] [@x @x])) Elapsed time: 2000.809 msecs [2 2] I figured that taking out the future would cause the execution to take twice as long, however, when I try this: user (time (let [x (do (Thread/sleep 2000) (+ 1 1))] [x x])) Elapsed time: 2000.512 msecs [2 2] as you see it takes about the same amount of time. Does this have something to do with the REPL evaluating things or maybe the newer version of Clojure handles things differently from the Joy of Clojure book? Thanks -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Sharing result of macro's calculation with the body
Hi, What you need is called an anaphoric macro (via symbol capture). Clojure makes it hard to do a symbol capture in macros since it qualifies all symbols automatically unless you use the auto gensym feature. This is done for hygiene purposes and to avoid any unintended side-effects. However indeed, it's possible to create such a macro in Clojure. Behold - (defmacro test-it [addend body] `(let [~'foo (+ ~addend 1)] ~@body)) ;; notice the ~' in front of foo. (macroexpand-1 '(test-it 1 (println foo))) ;= (clojure.core/let [foo (clojure.core/+ 1 1)] (println foo)) Please apply caution before using this feature; document the symbol to be captured sufficiently. Hope that helps. Regards, BG On Mon, Jul 1, 2013 at 7:44 PM, Sean Johnson belu...@acm.org wrote: Hello, If a macro calculates something and wants to make that result available to the body, what's the right way to do that? So far I've tried these ways which don't work (this is not really my macro, it's just a simplified example to demonstrate the issue): 1) lexical scope doesn't work, the symbol gets qualified (defmacro test-it [addend body] `(let [foo (+ ~addend 1)] ~@body)) = (test-it 3 (println foo)) CompilerException java.lang.RuntimeException: Can't let qualified name: fcms.app/foo, compiling:(NO_SOURCE_PATH:1:1) = (macroexpand '(test-it 3 (println foo))) (let* [fcms.app/foo (clojure.core/+ 3 1)] (println foo)) 2) autogen'ed lexical scope doesn't work, the body doesn't know what the autogen'ed symbol will be called (defmacro test-it [addend body] `(let [foo# (+ ~addend 1)] ~@body)) = (test-it 1 (println foo)) CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:1:12) = (macroexpand '(test-it 3 (println foo))) (let* [foo__5755__auto__ (clojure.core/+ 3 1)] (println foo)) 3) an interned var partially works, if the macro and its use are all in one namespace, but not if not, it fails to intern the var (defmacro test-it [addend body] `(do (def foo (+ ~addend 1)) ~@body)) = (test-it 3 (println foo)) 4 nil = (macroexpand '(test-it 3 (println foo))) (do (def fcms.app/foo (clojure.core/+ 3 1)) (println foo)) = (ns test) nil test= (fcms.app/test-it 3 (println foo)) CompilerException java.lang.RuntimeException: Can't create defs outside of current ns, compiling:(NO_SOURCE_PATH:1:1) I don't think my scenario is too unusual, but so far I haven't been able to find anything about how to best do this. It case it helps, the real macro is with-collection and it takes a collection name, does a lookup and some validation in a DB, then needs to share the collection's id with the body. Cheers, Sean -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Sharing result of macro's calculation with the body
+1 totally agree. Eg. clojure.core/with-open Sent from phone. Please excuse brevity. On 1 Jul 2013 20:58, Gary Trakhman gary.trakh...@gmail.com wrote: Whenever I make a macro like this, I pass the symbol to be captured as an argument to the macro. Any collisions would be more explicit and less surprising. On Mon, Jul 1, 2013 at 11:21 AM, Baishampayan Ghose b.gh...@gmail.comwrote: Hi, What you need is called an anaphoric macro (via symbol capture). Clojure makes it hard to do a symbol capture in macros since it qualifies all symbols automatically unless you use the auto gensym feature. This is done for hygiene purposes and to avoid any unintended side-effects. However indeed, it's possible to create such a macro in Clojure. Behold - (defmacro test-it [addend body] `(let [~'foo (+ ~addend 1)] ~@body)) ;; notice the ~' in front of foo. (macroexpand-1 '(test-it 1 (println foo))) ;= (clojure.core/let [foo (clojure.core/+ 1 1)] (println foo)) Please apply caution before using this feature; document the symbol to be captured sufficiently. Hope that helps. Regards, BG On Mon, Jul 1, 2013 at 7:44 PM, Sean Johnson belu...@acm.org wrote: Hello, If a macro calculates something and wants to make that result available to the body, what's the right way to do that? So far I've tried these ways which don't work (this is not really my macro, it's just a simplified example to demonstrate the issue): 1) lexical scope doesn't work, the symbol gets qualified (defmacro test-it [addend body] `(let [foo (+ ~addend 1)] ~@body)) = (test-it 3 (println foo)) CompilerException java.lang.RuntimeException: Can't let qualified name: fcms.app/foo, compiling:(NO_SOURCE_PATH:1:1) = (macroexpand '(test-it 3 (println foo))) (let* [fcms.app/foo (clojure.core/+ 3 1)] (println foo)) 2) autogen'ed lexical scope doesn't work, the body doesn't know what the autogen'ed symbol will be called (defmacro test-it [addend body] `(let [foo# (+ ~addend 1)] ~@body)) = (test-it 1 (println foo)) CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:1:12) = (macroexpand '(test-it 3 (println foo))) (let* [foo__5755__auto__ (clojure.core/+ 3 1)] (println foo)) 3) an interned var partially works, if the macro and its use are all in one namespace, but not if not, it fails to intern the var (defmacro test-it [addend body] `(do (def foo (+ ~addend 1)) ~@body)) = (test-it 3 (println foo)) 4 nil = (macroexpand '(test-it 3 (println foo))) (do (def fcms.app/foo (clojure.core/+ 3 1)) (println foo)) = (ns test) nil test= (fcms.app/test-it 3 (println foo)) CompilerException java.lang.RuntimeException: Can't create defs outside of current ns, compiling:(NO_SOURCE_PATH:1:1) I don't think my scenario is too unusual, but so far I haven't been able to find anything about how to best do this. It case it helps, the real macro is with-collection and it takes a collection name, does a lookup and some validation in a DB, then needs to share the collection's id with the body. Cheers, Sean -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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
Re: core.async
On Sat, Jun 29, 2013 at 4:37 PM, Peter Taoussanis ptaoussa...@gmail.com wrote: I honestly feel like I'm witnessing history being made. We all are. -BG -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Suggested 'server' for hosting clojure web app
Pick http-kit, create a uberjar with lein and deploy via Upstart etc. It works like a charm. Jetty is quite good too. ~BG Sent from phone. Please excuse brevity. On 29 Jun 2013 20:17, Ravindra Jaju ravindra.j...@gmail.com wrote: I want to deploy a small web app - serving mostly static content. I'm using Luminus (http://www.luminusweb.net/) - which is quite neat in the way it builds itself from well-known components. I'm having trouble deciding how to deploy it. I want some automation while deploying upgrades, and would like it to be light-weight. Jetty, http-kit, or immutant? (I tried immutant - but it seems to be taking up too much memory for my comfort, on my modest server.) Jetty and http-kit - I would like to hear about how I can deploy them as nice system daemons, with monitoring etc. so that they can be brought up automatically if something goes wrong. I'm also unable to find out how I can do a re-deploy without restarting. Any help or pointers appreciated! Thanks, jaju -- -- 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: Help deciphering ArityException message
This should work. What does headers look like? Sometimes the #(...) reader form can cause problems. Does using the (fn ...) form help? ~BG On Sun, Jun 30, 2013 at 5:39 AM, Dave Kincaid kincaid.d...@gmail.com wrote: Could someone help me decipher the ArityException I'm getting. It's not making sense to me. First here is the exception: ArityException Wrong number of args (1) passed to: lastN$reformat-headers$fn clojure.lang.AFn.throwArity (AFn.java:437) and here is the function reformat-headers: (defn reformat-headers [headers] (map #(.toString %) headers)) as far as I can tell the exception is saying that 1 argument is the wrong number of arguments for reformat-headers, but as you can clearly see it is a function of one argument. What am I interpreting wrong? Thanks, Dave -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: UnreadableForm exception trying to read an EDN file
Adding a method to the `print-dup` multimethod that dispatches on ByteArrayLongString should help. See here for an example - http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid kincaid.d...@gmail.com wrote: I'm using pprint to write out a map to a file then trying to read it back in using clojure.edn/read (I also get the same error using read). Here is the output (it's a map that was created by the Langohr rabbitmq library): {:header {:timestamp #inst 2058-04-07T17:56:17.000-00:00, :delivery-tag 2, :expiration nil, :correlation-id nil, :delivery-mode 1, :app-id nil, :user-id nil, :redelivery? true, :header {:headers ()}, :content-type nil, :persistent? false, :reply-to nil, :routing-key pims_data_capture, :headers {pluginKey #ByteArrayLongString PLUGIN2}, :type nil, :message-id nil, :cluster-id nil, :message-count 3, :exchange , :content-encoding nil, :priority nil}, :payload {\software\:\CSTONE\,\entity\:\\,} when I try to read it in I get an UnreadableForm exception. I've narrowed it down to the #ByteArrayLongString PLUGIN2 element. If I manually change that to just a regular string I can read it. What is the idiomatic way to handle this noting that there could be a number of different values in that :headers map. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Help deciphering ArityException message
What is the shape of `headers`? It looks like headers is a sequence of two-element sequences, in which case `reformat-headers` should be something like this - (defn reformat-headers [headers] (map (fn [[x y]] (hash-map [x 0] (.toString [y 1]))) headers)) ;; note the destructuring. The problem is, the lambda inside the map is expecting two args but is getting one arg (which is a two element sequence) instead. Hope that helps. ~BG On Sun, Jun 30, 2013 at 6:49 AM, Dave Kincaid kincaid.d...@gmail.com wrote: Here is the whole thing: (defn reformat-headers [headers] (debug (str Reformatting headers)) (map #(hash-map [%1 0] (.toString [%2 1])) headers)) (defn spit-messages Write out the messages in the given seq. [messages dest] (pprint (for [[metadata ^bytes payload] messages] {:header (update-in metadata [:headers] reformat-headers) :payload (String. payload)}) dest)) On Saturday, June 29, 2013 8:12:26 PM UTC-5, Baishampayan Ghose wrote: This should work. What does headers look like? Sometimes the #(...) reader form can cause problems. Does using the (fn ...) form help? ~BG On Sun, Jun 30, 2013 at 5:39 AM, Dave Kincaid kincai...@gmail.com wrote: Could someone help me decipher the ArityException I'm getting. It's not making sense to me. First here is the exception: ArityException Wrong number of args (1) passed to: lastN$reformat-headers$fn clojure.lang.AFn.throwArity (AFn.java:437) and here is the function reformat-headers: (defn reformat-headers [headers] (map #(.toString %) headers)) as far as I can tell the exception is saying that 1 argument is the wrong number of arguments for reformat-headers, but as you can clearly see it is a function of one argument. What am I interpreting wrong? Thanks, Dave -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: UnreadableForm exception trying to read an EDN file
Does this work? ;; do the defmethod extension as usual and then define spit-messages as such (defn spit-messages Write out the messages in the given seq. [messages dest] (binding [*print-dup* true] (pprint (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest))) ~BG On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid kincaid.d...@gmail.com wrote: Thanks! If that works, it is perfect. However, my first attempt isn't making any difference. Here is what I have: (defmethod print-dup com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) (defn spit-messages Write out the messages in the given seq. [messages dest] (print-dup (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest)) but it still prints it out to the file with #ByteArrayLongString PLUGIN2. Did I miss something? On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote: Adding a method to the `print-dup` multimethod that dispatches on ByteArrayLongString should help. See here for an example - http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid kincai...@gmail.com wrote: I'm using pprint to write out a map to a file then trying to read it back in using clojure.edn/read (I also get the same error using read). Here is the output (it's a map that was created by the Langohr rabbitmq library): {:header {:timestamp #inst 2058-04-07T17:56:17.000-00:00, :delivery-tag 2, :expiration nil, :correlation-id nil, :delivery-mode 1, :app-id nil, :user-id nil, :redelivery? true, :header {:headers ()}, :content-type nil, :persistent? false, :reply-to nil, :routing-key pims_data_capture, :headers {pluginKey #ByteArrayLongString PLUGIN2}, :type nil, :message-id nil, :cluster-id nil, :message-count 3, :exchange , :content-encoding nil, :priority nil}, :payload {\software\:\CSTONE\,\entity\:\\,} when I try to read it in I get an UnreadableForm exception. I've narrowed it down to the #ByteArrayLongString PLUGIN2 element. If I manually change that to just a regular string I can read it. What is the idiomatic way to handle this noting that there could be a number of different values in that :headers map. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: UnreadableForm exception trying to read an EDN file
This form, by the way is readable. Not sure why the print-dup extension is not working though... ~BG On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid kincaid.d...@gmail.com wrote: Hmm. No, it doesn't. This is what I get with pprint by itself: :headers {pluginKey #ByteArrayLongString PLUGIN2} with your version I get: :headers #=(java.util.HashMap. {pluginKey #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. PLUGIN2)}) what I think I needs to be able to read it back in is: :headers {pluginKey PLUGIN2} On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: Does this work? ;; do the defmethod extension as usual and then define spit-messages as such (defn spit-messages Write out the messages in the given seq. [messages dest] (binding [*print-dup* true] (pprint (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest))) ~BG On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid kincai...@gmail.com wrote: Thanks! If that works, it is perfect. However, my first attempt isn't making any difference. Here is what I have: (defmethod print-dup com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) (defn spit-messages Write out the messages in the given seq. [messages dest] (print-dup (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest)) but it still prints it out to the file with #ByteArrayLongString PLUGIN2. Did I miss something? On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote: Adding a method to the `print-dup` multimethod that dispatches on ByteArrayLongString should help. See here for an example - http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid kincai...@gmail.com wrote: I'm using pprint to write out a map to a file then trying to read it back in using clojure.edn/read (I also get the same error using read). Here is the output (it's a map that was created by the Langohr rabbitmq library): {:header {:timestamp #inst 2058-04-07T17:56:17.000-00:00, :delivery-tag 2, :expiration nil, :correlation-id nil, :delivery-mode 1, :app-id nil, :user-id nil, :redelivery? true, :header {:headers ()}, :content-type nil, :persistent? false, :reply-to nil, :routing-key pims_data_capture, :headers {pluginKey #ByteArrayLongString PLUGIN2}, :type nil, :message-id nil, :cluster-id nil, :message-count 3, :exchange , :content-encoding nil, :priority nil}, :payload {\software\:\CSTONE\,\entity\:\\,} when I try to read it in I get an UnreadableForm exception. I've narrowed it down to the #ByteArrayLongString PLUGIN2 element. If I manually change that to just a regular string I can read it. What is the idiomatic way to handle this noting that there could be a number of different values in that :headers map. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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
Re: UnreadableForm exception trying to read an EDN file
By the way, there is also the print-method multimethod which might just do the trick for you. Just try this one with your original version of `spit-messages` - http://clojuredocs.org/clojure_core/clojure.core/print-method ~BG On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid kincaid.d...@gmail.com wrote: Hmm. No, it doesn't. This is what I get with pprint by itself: :headers {pluginKey #ByteArrayLongString PLUGIN2} with your version I get: :headers #=(java.util.HashMap. {pluginKey #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. PLUGIN2)}) what I think I needs to be able to read it back in is: :headers {pluginKey PLUGIN2} On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: Does this work? ;; do the defmethod extension as usual and then define spit-messages as such (defn spit-messages Write out the messages in the given seq. [messages dest] (binding [*print-dup* true] (pprint (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest))) ~BG On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid kincai...@gmail.com wrote: Thanks! If that works, it is perfect. However, my first attempt isn't making any difference. Here is what I have: (defmethod print-dup com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) (defn spit-messages Write out the messages in the given seq. [messages dest] (print-dup (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest)) but it still prints it out to the file with #ByteArrayLongString PLUGIN2. Did I miss something? On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote: Adding a method to the `print-dup` multimethod that dispatches on ByteArrayLongString should help. See here for an example - http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid kincai...@gmail.com wrote: I'm using pprint to write out a map to a file then trying to read it back in using clojure.edn/read (I also get the same error using read). Here is the output (it's a map that was created by the Langohr rabbitmq library): {:header {:timestamp #inst 2058-04-07T17:56:17.000-00:00, :delivery-tag 2, :expiration nil, :correlation-id nil, :delivery-mode 1, :app-id nil, :user-id nil, :redelivery? true, :header {:headers ()}, :content-type nil, :persistent? false, :reply-to nil, :routing-key pims_data_capture, :headers {pluginKey #ByteArrayLongString PLUGIN2}, :type nil, :message-id nil, :cluster-id nil, :message-count 3, :exchange , :content-encoding nil, :priority nil}, :payload {\software\:\CSTONE\,\entity\:\\,} when I try to read it in I get an UnreadableForm exception. I've narrowed it down to the #ByteArrayLongString PLUGIN2 element. If I manually change that to just a regular string I can read it. What is the idiomatic way to handle this noting that there could be a number of different values in that :headers map. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- You received this message because you are subscribed to the Google
Re: UnreadableForm exception trying to read an EDN file
No problem, but I am sure someone else on this group will have the answer :) ~BG On Sun, Jun 30, 2013 at 7:33 AM, Dave Kincaid kincaid.d...@gmail.com wrote: Thank you very much for the help. I really appreciate you trying. I don't know what is going on, but I need to move on from this. Dave On Saturday, June 29, 2013 8:57:31 PM UTC-5, Baishampayan Ghose wrote: This form, by the way is readable. Not sure why the print-dup extension is not working though... ~BG On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid kincai...@gmail.com wrote: Hmm. No, it doesn't. This is what I get with pprint by itself: :headers {pluginKey #ByteArrayLongString PLUGIN2} with your version I get: :headers #=(java.util.HashMap. {pluginKey #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. PLUGIN2)}) what I think I needs to be able to read it back in is: :headers {pluginKey PLUGIN2} On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: Does this work? ;; do the defmethod extension as usual and then define spit-messages as such (defn spit-messages Write out the messages in the given seq. [messages dest] (binding [*print-dup* true] (pprint (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest))) ~BG On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid kincai...@gmail.com wrote: Thanks! If that works, it is perfect. However, my first attempt isn't making any difference. Here is what I have: (defmethod print-dup com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) (defn spit-messages Write out the messages in the given seq. [messages dest] (print-dup (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest)) but it still prints it out to the file with #ByteArrayLongString PLUGIN2. Did I miss something? On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote: Adding a method to the `print-dup` multimethod that dispatches on ByteArrayLongString should help. See here for an example - http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid kincai...@gmail.com wrote: I'm using pprint to write out a map to a file then trying to read it back in using clojure.edn/read (I also get the same error using read). Here is the output (it's a map that was created by the Langohr rabbitmq library): {:header {:timestamp #inst 2058-04-07T17:56:17.000-00:00, :delivery-tag 2, :expiration nil, :correlation-id nil, :delivery-mode 1, :app-id nil, :user-id nil, :redelivery? true, :header {:headers ()}, :content-type nil, :persistent? false, :reply-to nil, :routing-key pims_data_capture, :headers {pluginKey #ByteArrayLongString PLUGIN2}, :type nil, :message-id nil, :cluster-id nil, :message-count 3, :exchange , :content-encoding nil, :priority nil}, :payload {\software\:\CSTONE\,\entity\:\\,} when I try to read it in I get an UnreadableForm exception. I've narrowed it down to the #ByteArrayLongString PLUGIN2 element. If I manually change that to just a regular string I can read it. What is the idiomatic way to handle this noting that there could be a number of different values in that :headers map. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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
Re: UnreadableForm exception trying to read an EDN file
Cool! ~BG On Sun, Jun 30, 2013 at 7:49 AM, Dave Kincaid kincaid.d...@gmail.com wrote: That works perfectly! Thank you again very much. On Saturday, June 29, 2013 9:01:32 PM UTC-5, Baishampayan Ghose wrote: By the way, there is also the print-method multimethod which might just do the trick for you. Just try this one with your original version of `spit-messages` - http://clojuredocs.org/clojure_core/clojure.core/print-method ~BG On Sun, Jun 30, 2013 at 7:18 AM, Dave Kincaid kincai...@gmail.com wrote: Hmm. No, it doesn't. This is what I get with pprint by itself: :headers {pluginKey #ByteArrayLongString PLUGIN2} with your version I get: :headers #=(java.util.HashMap. {pluginKey #=(com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString. PLUGIN2)}) what I think I needs to be able to read it back in is: :headers {pluginKey PLUGIN2} On Saturday, June 29, 2013 8:41:16 PM UTC-5, Baishampayan Ghose wrote: Does this work? ;; do the defmethod extension as usual and then define spit-messages as such (defn spit-messages Write out the messages in the given seq. [messages dest] (binding [*print-dup* true] (pprint (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest))) ~BG On Sun, Jun 30, 2013 at 7:05 AM, Dave Kincaid kincai...@gmail.com wrote: Thanks! If that works, it is perfect. However, my first attempt isn't making any difference. Here is what I have: (defmethod print-dup com.rabbitmq.client.impl.LongStringHelper$ByteArrayLongString [o w] (print-ctor o (fn [o w] (print-dup (String. (.getBytes o)) w)) w)) (defn spit-messages Write out the messages in the given seq. [messages dest] (print-dup (for [[metadata ^bytes payload] messages] {:header metadata :payload (String. payload)}) dest)) but it still prints it out to the file with #ByteArrayLongString PLUGIN2. Did I miss something? On Saturday, June 29, 2013 8:14:49 PM UTC-5, Baishampayan Ghose wrote: Adding a method to the `print-dup` multimethod that dispatches on ByteArrayLongString should help. See here for an example - http://clojuredocs.org/clojure_core/clojure.core/print-dup ~BG On Sun, Jun 30, 2013 at 5:47 AM, Dave Kincaid kincai...@gmail.com wrote: I'm using pprint to write out a map to a file then trying to read it back in using clojure.edn/read (I also get the same error using read). Here is the output (it's a map that was created by the Langohr rabbitmq library): {:header {:timestamp #inst 2058-04-07T17:56:17.000-00:00, :delivery-tag 2, :expiration nil, :correlation-id nil, :delivery-mode 1, :app-id nil, :user-id nil, :redelivery? true, :header {:headers ()}, :content-type nil, :persistent? false, :reply-to nil, :routing-key pims_data_capture, :headers {pluginKey #ByteArrayLongString PLUGIN2}, :type nil, :message-id nil, :cluster-id nil, :message-count 3, :exchange , :content-encoding nil, :priority nil}, :payload {\software\:\CSTONE\,\entity\:\\,} when I try to read it in I get an UnreadableForm exception. I've narrowed it down to the #ByteArrayLongString PLUGIN2 element. If I manually change that to just a regular string I can read it. What is the idiomatic way to handle this noting that there could be a number of different values in that :headers map. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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
Re: How to: reduce boolean operations?
Using a lambda seems to be a sane approach - (reduce #(and %1 %2) '(false false true)) ;= false On Wed, May 22, 2013 at 5:36 AM, Peter Mancini pe...@cicayda.com wrote: OK long time lurker here. I've been growing in my Clojure strength for a while now. For the most part I think I get it and I have no problem getting programs to do what I want. However, sometimes I get stumped. I have one function that produces a list of booleans like '(false false true). It seemed to me that this should be legal: (reduce and '(false false true)) However that is not legal with the complaint being something about and being a macro. :-/ I did get it to work with: (eval (conj '(false false true) 'and)) It works but is it correct? Is it what you would do? I noticed that '(nil nil true) will cause and to produce false, so I am aware of that edge case. Anything else I should be aware of? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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] - purnam 0.0.9 (javascript.dot.notation language extensions for cljs)
Really interesting code! Good work. ~BG Sent from phone. Please excuse brevity. On 12 May 2013 15:07, zcaudate z...@caudate.me wrote: This is a quick and dirty release for interested parties. I found it very useful when working with angularjs. The syntax should not change that much but there will be more documentation in the future. I would love to have some input into additional features that could be added. Excerpt from Github: https://github.com/zcaudate/purnam Installation In your project file, add [purnam 0.0.9] Why? Because the javascript dot-notation is awesome and the javascript/clojurescript interop (aget aset, .fn and .-propaccessors) make for really ugly code. Using the language-extension macros, clojurescript becomes more than twice as concise when working with existing javascript libraries (I'm mainly working with angularjs). So the use case can be seen below: https://github.com/zcaudate/purnam#gettersGetters: ## javascript (12 keystrokes): object.a.b.c ## clojurescript (45 keystrokes): (- object (aget a) (aget b) (aget c)) ## clojurescript + purnam (16 keystrokes): (? object.a.b.c) https://github.com/zcaudate/purnam#settersSetters: ## javascript (17 keystrokes): object.a.b.c = 10 ## clojurescript (48 keystrokes): (- object (aget a) (aget b) (aset c 10)) ## clojurescript + purnam (19 keystrokes): (! object.a.b.c 10) https://github.com/zcaudate/purnam#functionsFunctions: These are really bad examples of code but its what usually happens when working with existing javascript libraries. Using the dot-notation can save alot of screen and head space: ## javascript (~100 chars): var bad_code = function(obj, val){ obj.inner.number = 10; val.inner.count = obj.inner.count + 10;} ## clojurescript (~180 chars): (defn bad-code [obj val] (- obj (aget inner) (aset number 10)) (- val (aget inner) (aset count (+ 10 (- obj (aget inner) (aget count) nil) ## clojurescript + purnam (~110 chars): (def.n bad-code [obj val] (! obj.inner.number 10) (! val.inner.count (+ 10 obj.inner.count)) nil) https://github.com/zcaudate/purnam#installation -- -- 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: Now *there*'s a machine made for Clojure.
A dated but relevant discussion between Rich Hickey and Dr. Cliff Click, ex-CTO Azul Systems - http://www.azulsystems.com/blog/cliff/2008-05-27-clojure-stms-vs-locks Sent from phone. Please excuse brevity. On 28 Apr 2013 10:04, Timothy Baldridge tbaldri...@gmail.com wrote: E-mail thread had less to do with issues of Clojure per se, but more with issues the JVM had running on a 48-way machine. Or am I missing something? IIRC the Azul people played with Clojure a bit, I wonder if their suped-up JVM allows Clojure to perform any better. Timothy On Sat, Apr 27, 2013 at 9:36 PM, Lee Spector lspec...@hampshire.eduwrote: I don't want to be too much of a downer, but our experience running Clojure on 48-core machines was pretty depressing, with our speedups often being near zero or even negative (that is, running on 48 cores can be slower than running on 1, for a task that would seem to be a good candidate for parallelization, and with what would seem to be good techniques for doing the parallelization). Several people tried to help us diagnose/fix the problems (see this thread: https://groups.google.com/forum/?fromgroups=#!topic/clojure/48W2eff3caU), but I don't think that there has been a definitive resolution. -Lee On Apr 27, 2013, at 11:23 PM, Yves S. Garret wrote: I'll take a blind stab at this and say that Erlang might actually do more poorly, unless the chip's interchip message passing is taken advantage of by Erlang. If there's a separate piece of hardware taking on the role of being the messenger, having to waste computer cycles to send a message isn't terribly efficient. On Sat, Apr 27, 2013 at 11:17 PM, Cedric Greevey cgree...@gmail.com wrote: On Sat, Apr 27, 2013 at 11:13 PM, Yves S. Garret yoursurrogate...@gmail.com wrote: How would this compare to Erlang? On Sat, Apr 27, 2013 at 10:51 PM, Cedric Greevey cgree...@gmail.com wrote: https://en.wikipedia.org/wiki/Intel_MIC 50+ cores?! Clojure will leave every other language in the dust on something like that, thanks to its inherently scaleable concurrency constructs. Try writing a 50-threaded Java application without getting deadlocks all over the place, or cheating and using very coarse-grained locks (have fun with the task manager showing 2% CPU utilization when your app is running full-bore!). If big, 32-bit addressing spaces were what made automatic memory management really begin to come into its own (and with it, Java), then it's doubtless 50-core machines that will make automatic concurrency management really begin to come into its own. Erlang might also do well on such a machine. The actor model likely involves more communication among the cores to get full utilization, but then, the page describes some sort of message-passing system among the cores on MIC, so ... -- -- 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. -- Lee Spector, Professor of Computer Science Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 -- -- 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
Re: Clojure special forms
So reduce here is actually written in Java, hence the call to the .reduce method. It's perfectly possible to write reduce in pure Clojure today but it's probably not done that way because of performance reasons. For the real special forms you will have to look at the Clojure compiler source starting from here - https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L39 Regards, BG On Mon, Apr 29, 2013 at 6:21 PM, David Simmons shortlypor...@gmail.com wrote: Hi I am just setting out to learn Clojure (my 2nd attempt) and am starting to feel more comfortable with the language (and very excited about the possibilities). However, I'm reading Clojure Programming (Emerick, Carper and Grand) and read that Special forms are the primitive building blocks on which the rest of the language is built. I therefore thought that every function defined in Clojure.core would be defined in terms of the specials forms in some way. So I looked at the source for reduce to see that it actually makes a call to java . reduce. This would imply that the special forms are not quite what I understood. Am I right in thinking that certain Lisps do indeed define all of their higher level functions in terms of a very small subset of special forms or have I completely misunderstood. Kind Regards Dave -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Baishampayan Ghose b.ghose at gmail.com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure special forms
Absolutely! Thanks Michael. Sent from phone. Please excuse brevity. On 29 Apr 2013 18:36, Michael Klishin michael.s.klis...@gmail.com wrote: 2013/4/29 Baishampayan Ghose b.gh...@gmail.com For the real special forms you will have to look at the Clojure compiler source starting from here - https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L39 or http://clojure-doc.org/articles/language/macros.html#special_forms :) -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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] Grojure, a Java/C# syntax atop Clojure using Kern
Very nice work! ~BG On Mon, Apr 29, 2013 at 10:11 AM, Gavin Grover gavingroovygro...@gmail.com wrote: Grojure is a Java/C#/Groovy-like syntax atop Clojure using the Kern parser combinator library. It's also of interest as an example grammar for those using Kern to build their own grammars. Available from https://github.com/gavingroovygrover/grojure Gavin Groovy Grover -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: memorize-clj
One more reason to read Clojure's source code. Trust me, it's surprisingly easy to understand. Sent from phone. Please excuse brevity. On 29 Apr 2013 09:29, Jorge Urdaneta jorge.urdan...@gmail.com wrote: Thank you. Shame on me On 28/04/13 23:28, Gary Trakhman wrote: Clojure has the http://clojuredocs.org/clojure_core/clojure.core/memoize function built-in, as well as https://github.com/clojure/core.memoize for more complicated stuff. On Sun, Apr 28, 2013 at 11:51 PM, Jorge Urdaneta jorge.urdan...@gmail.com wrote: Hi, I started a library called memorize-clj https://github.com/jorgeu/memorize-clj It provides a function memorize that take a function and cache its results using guava cache. Of course the function must be pure and the parameters should be easy to compare and get a hashcode. Maybe I'm reinventing the wheel here but it was fun to build anyway. I saw this feature in Groovy and couldn't found anything equivalent for Clojure. -- Jorge Urdaneta -- -- 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. -- Jorge Urdaneta -- -- 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: Best way to (map) a sequence, but return 0-n items per input item?
Does mapcat work? Or may be reduce with merge after the map? An example would help. ~BG On Thu, Apr 11, 2013 at 8:56 AM, Steven Degutis sbdegu...@gmail.com wrote: The idea I already have in mind is to pass a function to map that returns a sequence whose size can vary, and flatten the results of the map. This will probably work, but is there a more elegant way? What about more efficient? Note: the items returned will be Clojure maps. -Steven -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: let [{:keys [root watcher auth-conf], :or {auth-conf auth-conf, root root, watcher watcher}} {:auth-conf aaaaa, :watcher bbbbbbb}]
This the syntax for map destructuring. Works on function argument vector and let bindings. You'll find multiple online resources that explain this clearly. Sent from phone. Please excuse brevity. On 14 Mar 2013 21:07, zlj844...@gmail.com wrote: *excuse me, when I read the storm src,I catch some code as follows* * * *(let [{:keys [root watcher auth-conf], :or {auth-conf auth-conf, root root, watcher watcher}} {:auth-conf a, :watcher bbb}]* *(println auth-conf)(println root)(println watcher)* *)* * * *I don't know what's it means like * * * *(let [{:keys [root watcher auth-conf], :or {auth-conf auth-conf, root root, watcher watcher}} {:auth-conf a, :watcher bbb}])* * * *codes* * * *can some one help me, thanks* -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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] uWSGI support for ring (early stage)
This is something really awesome! Clojure Python co-existing together in a single web stack is a very interesting idea. Excited to see where this goes. ~BG On Fri, Mar 8, 2013 at 8:07 PM, Mingli Yuan mingli.y...@gmail.com wrote: Hi, folks, Yesterday uWSGI had released a ring plugins to give basic support for Clojure webdev. https://uwsgi-docs.readthedocs.org/en/latest/Ring.html https://uwsgi-docs.readthedocs.org/en/latest/JVM.html http://lists.unbit.it/pipermail/uwsgi/2013-March/005549.html http://lists.unbit.it/pipermail/uwsgi/2013-March/005562.html It is still in early stage, and not production-ready, but we plan to evolve it into mature. JVM and ring support had been settled in the roadmap of next recent versions of uWSGI. And thanks for the great support from unbit team and Roberto, the original author of uWSGI. The reason we, a small team in Beijing, adopt a C-based web container are as below: We use both python and clojure heavily. uWSGI work with nginx smoothly. Easy config and management of uWSGI We are open source supporters In next few weeks, we will test this ring implementation thoroughly. Any comments and participation are welcomed! Thanks. Regards, Mingli -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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] clj-toml 0.2.0
Nice! I was thinking about writing a parser myself but you beat me to the punch :) ~BG On Mon, Feb 25, 2013 at 2:56 PM, Luca Antiga luca.ant...@orobix.com wrote: Quick announcement: clj-toml 0.2.0 is available on Clojars. clj-toml is a TOML parser for Clojure. It was written on top of the Kern library by Armando Blancas (kudos). TOML is a minimalistic, human-readable format that maps to a hash (like INI, but more evolved). Cheers, Luca -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: RC 16: Last chance to test against Clojure 1.5 before it ships
You can create an ExceptionInfo instance easily by using the core fn `ex-info`. So something like ... (throw (ex-info {:foo bar})) works fine. ~BG On Sun, Feb 17, 2013 at 10:05 PM, vemv v...@vemv.net wrote: Couldn't clojure.lang.ExceptionInfo be imported by default? That'd surely help making ExceptionInfo the idiomatic exception to be thrown. On Thursday, February 14, 2013 4:33:42 AM UTC+1, stuart@gmail.com wrote: If you care about Clojure 1.5 compatibility for your codebase, please test it against RC 16 as soon as possible. You can get the source and build it yourself from [1], or wait for Maven Central [2] to pick up the CI build, which usually takes a few hours. Thanks! Stu [1] https://github.com/clojure/clojure [2] http://bit.ly/WEnjAi -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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 set the value of a static variable in a java factory class from clojure?
Haven't looked at the code, but `set!` should work. ~BG Sent from phone. Please excuse brevity. On 14 Feb 2013 21:30, Joachim De Beule joachim.de.be...@gmail.com wrote: Hi All, I know how to call static java methods such as the ones defined here: http://grepcode.com/file/repo1.maven.org/maven2/org.apache.opennlp/opennlp-maxent/3.0.2-incubating/opennlp/maxent/GIS.java, e.g. trainModel(...). However, before I call this method I want to change the value of the variable SMOOTHING_OBSERVATION (see above link section #SMOOTHING_OBSERVATION). My problem is that I don't know how to do that from clojure? Thanks a lot! Joachim -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Can't use Clojure 1.5 with emacs and swank
Devin, would you be kind enough to share the hackery you did to get nREPL to work like a normal slime/swank setup? I personally found many of the keybinding choices in nrepl.el to be quite different from slime/swank. ~BG On Tue, Feb 12, 2013 at 5:05 AM, Devin Walters dev...@gmail.com wrote: That's definitely the issue. Switch to nrepl or see if there's an updated swank-clojure. I switched and it took some getting used to and hackery to get it working like my swank setup did, but I think it was worth it. '(Devin Walters) On Feb 11, 2013, at 5:01 PM, David Nolen dnolen.li...@gmail.com wrote: I'm not sure if swank-clojure has been patched for 1.5, I believe the line column information changes might have broken things. nrepl.el works pretty well as a replacement and development seems to be moving along pretty quickly. David On Mon, Feb 11, 2013 at 5:53 PM, JvJ kfjwhee...@gmail.com wrote: I added 1.5.0-beta13 to my lein project file, and now I get something like this when I try M-x clojure-jack-in signal(error (Could not start swank server: ...etc... Does anyone know what I should do about this? Thanks. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: recommended way to write loop where a binding depends on a previous 'useless binding' operation?
What's the stopping condition for your loop? ~BG On Tue, Feb 12, 2013 at 12:55 PM, George Oliver georgeolive...@gmail.com wrote: hi, I have a loop that looks like this, (loop [x (a-function) y (another-function)] ; another-function must be called after a-function () ; x is not used in body (recur (a-function) (another-function))) This gets the job done (my a-function is a select() call which I don't use the return value of in the body), but it feels a little hacky so I'm wondering what's a better way? -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Article on Clojure concurrency from Computing in Science and Engineering
The article is quite unreadable due to bad formatting. Is it possible to get a PDF? ~BG On Fri, Feb 8, 2013 at 4:00 PM, Konrad Hinsen googlegro...@khinsen.fastmail.net wrote: The article Clojure for Number Crunching on Multicore Machines by Martin Kalin and David Miller Computing in Science and Engineering Nov/Dec 2012 is in free access at the moment: http://www.computer.org/portal/web/computingnow/content?g=53319type=articleurlTitle=clojure-for-number-crunching-on-multicore-machin-1 Konrad. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: is there a way to get the arguments to a function from outside the function?
Checkout http://github.com/clojure/tools.trace ~BG Sent from phone. Please excuse brevity. On 4 Feb 2013 20:48, larry google groups lawrencecloj...@gmail.com wrote: I have an app. I would like to have debug mode and a production mode. In the debug mode, I would like it if the arguments to each function were pprint'ed to the terminal. Is there anyway to do this gracefully. I started adding pprint to all of my functions, and then I thought There has got to be a way that is more elegant than this. -- -- 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: *read-eval* vulnerability
I put the canonical clojure artefact in a global exclusions vector in my project.clj. The classpath doesn't have any duplicate clojure jar in it. I was testing it out with `lein repl`, since swank-clojure is broken in different ways. Regards, BG On Sat, Feb 2, 2013 at 7:43 PM, Chas Emerick c...@cemerick.com wrote: Hi Baishampayan, I got such errors when I first started working on the patch; they were caused by the compiler using print-dup'd strings to create namespaces instead of emitting bytecode (which the patched build includes). Is it possible that you have both an org.clojure/clojure jar and the patched com.cemerick/clojure jar on your classpath? FWIW, such metadata happens to exist in some nREPL namespaces, and some of my projects as well, so I presume that that's not the actual problem. Just out of curiosity, do things work well if you use e.g. inferior-lisp or ritz? Thanks for testing! - Chas On Feb 1, 2013, at 11:10 PM, Baishampayan Ghose wrote: Just did some testing with our code-base and Clojure 1.5.0-RC4 (with and without Chas' read-eval patch). There is definitely something strange going on. Things worked just fine with 1.5.0-RC4 but with the read-eval patch `lein swank` is completely broken but more than that, our code is failing to compile with this weird error - eval-reader: (clojure.lang.PersistentArrayMap/create {:author Joe Dev j...@helpshift.com, :doc Some doc here.}) RuntimeException EvalReader not allowed when *read-eval* is false. clojure.lang.Util.runtimeException (Util.java:219) Almost all our namespaces have documentation attached via metadata like this - (ns ^{:doc Some doc here. :author Joe Dev j...@helpshift.com} com.helpshift.some.ns (:require [com.helpshift.other.ns :as chon]) (:use clojure.test midje.sweet)) FWIW, the file that will fail to compile is random and I couldn't reproduce this error on a fresh project with just a couple of files. It's quite clear that the eval-reader is getting used from inside Clojure and we need to test out the edge cases a bit more. This is clearly not a low-impact fix, but IMHO we should take the time and get it right before 1.5.0 Regards, BG On Sat, Feb 2, 2013 at 4:01 AM, Chas Emerick c...@cemerick.com wrote: I have added a patch to CLJ-1153 that appears to address the *read-eval* problem: http://dev.clojure.org/jira/browse/CLJ-1153?focusedCommentId=30523#comment-30523 code on github: https://github.com/cemerick/clojure/commit/1f5c19c07443d2535ede4ff71d23b40c195d617f artifact on Clojars: [com.cemerick/clojure 1.5.0-SNAPSHOT] The Leiningen dependency above is 1.5.0-RC4 + the patch on the ticket. Note that you'll need to set your project's global :exclusions to [org.clojure/clojure] in order for the com.cemerick/clojure artifact to supersede it. It tests well for me, but needs to be exercised as much as possible. Some have already done so (there's an ongoing discussion on the clojure-dev ML with some initial test experiences: http://groups.google.com/group/clojure-dev/browse_frm/thread/cc6f747919db6c94), but I'm hoping that we can get as many eyes as possible on this — doing both testing as well as code/patch examination — so as to ensure correctness and maximize the chances of 1.5.0 final going out with this vulnerability buttoned up. Thanks, - Chas -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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
Re: *read-eval* vulnerability
$apply.invoke(core.clj:619) at clojure.core$load_libs.doInvoke(core.clj:5403) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:621) at clojure.core$use.doInvoke(core.clj:5497) at clojure.lang.RestFn.invoke(RestFn.java:512) at swank.swank$loading__4935__auto__.invoke(swank.clj:1) at clojure.lang.AFn.applyToHelper(AFn.java:159) at clojure.lang.AFn.applyTo(AFn.java:151) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3460) at clojure.lang.Compiler.compile1(Compiler.java:7190) at clojure.lang.Compiler.compile1(Compiler.java:7180) at clojure.lang.Compiler.compile(Compiler.java:7255) at clojure.lang.RT.compile(RT.java:389) at clojure.lang.RT.load(RT.java:429) at clojure.lang.RT.load(RT.java:402) at clojure.core$load$fn__5043.invoke(core.clj:5520) at clojure.core$load.doInvoke(core.clj:5519) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5326) at clojure.core$load_lib$fn__4992.invoke(core.clj:5365) at clojure.core$load_lib.doInvoke(core.clj:5364) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:619) at clojure.core$load_libs.doInvoke(core.clj:5403) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:621) at clojure.core$use.doInvoke(core.clj:5497) at clojure.lang.RestFn.invoke(RestFn.java:805) at moby.core$loading__4935__auto__.invoke(core.clj:1) at clojure.lang.AFn.applyToHelper(AFn.java:159) at clojure.lang.AFn.applyTo(AFn.java:151) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3460) at clojure.lang.Compiler.compile1(Compiler.java:7190) at clojure.lang.Compiler.compile1(Compiler.java:7180) at clojure.lang.Compiler.compile(Compiler.java:7255) at clojure.lang.RT.compile(RT.java:389) at clojure.lang.RT.load(RT.java:429) at clojure.lang.RT.load(RT.java:402) at clojure.core$load$fn__5043.invoke(core.clj:5520) at clojure.core$load.doInvoke(core.clj:5519) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5326) at clojure.core$load_lib$fn__4992.invoke(core.clj:5365) at clojure.core$load_lib.doInvoke(core.clj:5364) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:619) at clojure.core$load_libs.doInvoke(core.clj:5403) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:619) at clojure.core$require.doInvoke(core.clj:5486) at clojure.lang.RestFn.invoke(RestFn.java:457) at api.lib.server$loading__4935__auto__.invoke(server.clj:1) at clojure.lang.AFn.applyToHelper(AFn.java:159) at clojure.lang.AFn.applyTo(AFn.java:151) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3460) at clojure.lang.Compiler.compile1(Compiler.java:7190) at clojure.lang.Compiler.compile1(Compiler.java:7180) at clojure.lang.Compiler.compile(Compiler.java:7255) at clojure.lang.RT.compile(RT.java:389) at clojure.lang.RT.load(RT.java:429) at clojure.lang.RT.load(RT.java:402) at clojure.core$load$fn__5043.invoke(core.clj:5520) at clojure.core$load.doInvoke(core.clj:5519) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5326) at clojure.core$compile$fn__5048.invoke(core.clj:5531) at clojure.core$compile.invoke(core.clj:5530) at user$eval7.invoke(NO_SOURCE_FILE:1) at clojure.lang.Compiler.eval(Compiler.java:6659) at clojure.lang.Compiler.eval(Compiler.java:6649) at clojure.lang.Compiler.eval(Compiler.java:6622) at clojure.core$eval.invoke(core.clj:2852) at clojure.main$eval_opt.invoke(main.clj:300) at clojure.main$initialize.invoke(main.clj:319) at clojure.main$null_opt.invoke(main.clj:354) at clojure.main$main$fn__6682.invoke(main.clj:432) at clojure.main$main.doInvoke(main.clj:429) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:419) at clojure.lang.AFn.applyToHelper(AFn.java:163) at clojure.lang.Var.applyTo(Var.java:532) at clojure.main.main(main.java:37) Caused by: java.lang.IllegalArgumentException: No matching ctor found for class clojure.lang.Compiler$CompilerException at clojure.lang.Compiler$NewExpr.init(Compiler.java:2415) at clojure.lang.Compiler$NewExpr$Parser.parse(Compiler.java:2502) at clojure.lang.Compiler.analyzeSeq(Compiler.java:6600) ... 167 more On Sat, Feb 2, 2013 at 7:43 PM, Chas Emerick c...@cemerick.com wrote: Hi Baishampayan, I got such errors when I first started working on the patch; they were caused by the compiler using print-dup'd strings to create namespaces instead of emitting bytecode (which the patched build includes). Is it possible that you have both an org.clojure/clojure jar and the patched com.cemerick/clojure jar on your classpath? FWIW, such metadata happens to exist in some nREPL namespaces, and some of my projects as well, so I presume that that's not the actual problem. Just out of curiosity, do things work well if you use e.g. inferior-lisp or ritz? Thanks for testing! - Chas On Feb 1, 2013, at 11:10 PM, Baishampayan Ghose wrote: Just did some
Re: ANN: http-kit 2.0.0.RC2, high performance HTTP Server Client for Clojure
Congratulations, Feng. HTTP-Kit is awesome! ~BG On Sun, Feb 3, 2013 at 8:50 AM, Shen, Feng shen...@gmail.com wrote: Hi, After extensive test, known bugs fixed, documentation ready, http-kit reaches 2.0.0.RC2 [http-kit 2.0.0-RC2] ; Add to your project.clj Documentation: http://http-kit.org Github: https://github.com/http-kit/http-kit The goal of http-kit is to provide a clean, robust HTTP server/client, with Nginx alike performance and concurrency, for Clojure. The server is ring compliant adapter with async and websocket support. I expect it to be faster than node. The client has a clj-http alike API, asynchronous in nature, synchronous with @promise. I invite everybody who interested to have a look, questions/comments/suggestions/whatever are welcome! Thanks @ptaoussanis and others for their contribution. Feng -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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 read a txt file?
clojure.core/slurp Sent from phone. Please excuse brevity. On 1 Feb 2013 18:13, Roger75 rcana...@gmail.com wrote: I'd like to read a txt file using clojure. How do I do that? Any examples? -- -- 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: *read-eval* vulnerability
Just did some testing with our code-base and Clojure 1.5.0-RC4 (with and without Chas' read-eval patch). There is definitely something strange going on. Things worked just fine with 1.5.0-RC4 but with the read-eval patch `lein swank` is completely broken but more than that, our code is failing to compile with this weird error - eval-reader: (clojure.lang.PersistentArrayMap/create {:author Joe Dev j...@helpshift.com, :doc Some doc here.}) RuntimeException EvalReader not allowed when *read-eval* is false. clojure.lang.Util.runtimeException (Util.java:219) Almost all our namespaces have documentation attached via metadata like this - (ns ^{:doc Some doc here. :author Joe Dev j...@helpshift.com} com.helpshift.some.ns (:require [com.helpshift.other.ns :as chon]) (:use clojure.test midje.sweet)) FWIW, the file that will fail to compile is random and I couldn't reproduce this error on a fresh project with just a couple of files. It's quite clear that the eval-reader is getting used from inside Clojure and we need to test out the edge cases a bit more. This is clearly not a low-impact fix, but IMHO we should take the time and get it right before 1.5.0 Regards, BG On Sat, Feb 2, 2013 at 4:01 AM, Chas Emerick c...@cemerick.com wrote: I have added a patch to CLJ-1153 that appears to address the *read-eval* problem: http://dev.clojure.org/jira/browse/CLJ-1153?focusedCommentId=30523#comment-30523 code on github: https://github.com/cemerick/clojure/commit/1f5c19c07443d2535ede4ff71d23b40c195d617f artifact on Clojars: [com.cemerick/clojure 1.5.0-SNAPSHOT] The Leiningen dependency above is 1.5.0-RC4 + the patch on the ticket. Note that you'll need to set your project's global :exclusions to [org.clojure/clojure] in order for the com.cemerick/clojure artifact to supersede it. It tests well for me, but needs to be exercised as much as possible. Some have already done so (there's an ongoing discussion on the clojure-dev ML with some initial test experiences: http://groups.google.com/group/clojure-dev/browse_frm/thread/cc6f747919db6c94), but I'm hoping that we can get as many eyes as possible on this — doing both testing as well as code/patch examination — so as to ensure correctness and maximize the chances of 1.5.0 final going out with this vulnerability buttoned up. Thanks, - Chas -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Prismatic Plumbing and Graph Open-Source Release
Try Firefox. ~BG On Fri, Feb 1, 2013 at 10:08 AM, AtKaaZ atk...@gmail.com wrote: if you put that on youtube, let me know, currently I cannot see the slides or they are simply stuck on the first slide and never change (the video works though) On Fri, Feb 1, 2013 at 5:31 AM, Alex Miller a...@puredanger.com wrote: The video of the talk on Graph from Strange Loop just came out: http://www.infoq.com/presentations/Graph-Clojure-Prismatic On Tuesday, January 29, 2013 12:46:54 PM UTC-6, Aria Haghighi wrote: Hey all, Prismatic has open-sourced our Plumbing and Graph library on github. Jason Wolfe gave a talk about how we use graph for systems composition at Strange loop last year. Please give the library a whirl and let us know if you're using it and if you find any issues or feature requests. We use this library very heavily throughout our code and hope others find it useful as well. Best, Aria -- -- 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. -- Please correct me if I'm wrong or incomplete, even if you think I'll subconsciously hate it. -- -- 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. -- Baishampayan Ghose b.ghose at gmail.com -- -- 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: Simple FIFO cache for memoize
Take a look at core.cache - https://github.com/clojure/core.cache ~BG On Wed, Jan 23, 2013 at 1:11 PM, Omer Iqbal momeriqb...@gmail.com wrote: I've been reading a bit about the STM, and here's an implementation of a FIFO cache for producing a memoized version of a function. Is it correct to use the STM in this case, or are there any drawbacks? (defn bounded-memoize Return a bounded memoized version of fn 'f' that caches the last 'k' computed values [f k] (let [cache (ref {}) values (ref clojure.lang.PersistentQueue/EMPTY)] (fn [ args] (if-let [e (find @cache args)] (val e) (let [result (apply f args)] (dosync (alter values conj args) (alter cache assoc args result) (if ( (count @values) k) (let [evict (peek @values)] (alter values pop) (alter cache dissoc evict)) ) result )) ) )) ) -- -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: a question about running embedded jetty
On Sat, Jan 19, 2013 at 5:24 AM, faenvie fanny.aen...@gmx.de wrote: i have learned that for a ring/compojure-app the embedded jetty service can be started like this: (def app (handler/site routes)) (defn start [port] (ring/run-jetty (var app) {:port (or port 8080) :join? false})) can anyone explain, what is the var for ? why '(var app)' or #'app ? i found some remarks about being able to change the app without having to restart the server but how exactly does this relate ? If you pass in the app as it is, then the var gets evaluated to the function that the var refers to and the jetty adapter uses that function to run the server. Now if you recompile your ring handlers (aka functions) the same app var will get rebound to a new function while the jetty server will continue holding on to the old handler function, so if you refresh the page, etc. you won't see the change on your browser. You will have to kill the server and restart jetty. If you pass just the var instead, jetty holds on to the container (the var) and not the value. The jetty-adapter derefs the var on every request and sends the response back. As a result if you recompile your handlers you'll see the effects immediately without restarting the server. The derefing has a penalty, albeit minor. Thus, you may choose to not pass in the app as a var in production deployments. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: (newbie) function return results
On Sat, Jan 19, 2013 at 11:32 PM, Colin Yates colin.ya...@gmail.com wrote: I am struggling to understand what Clojure is doing. This is definitely a newbie question but I cannot figure it out :). The question is best asked via a repl session: [code]user= (defn create-user [] {:id 1}) #'user/create-user user= (create-user) {:id 1} user= (take 10 (repeatedly create-user)) ({:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1}) user= (defn stream1 [] repeatedly create-user) #'user/stream1 user= (take 10 stream1) IllegalArgumentException Don't know how to create ISeq from: user$stream1 clojure.lang.RT.seqFrom (RT.java:494) user= (take 10 (stream1)) IllegalArgumentException Don't know how to create ISeq from: user$create_user clojure.lang.RT.seqFrom (RT.java:494) The mistake is in the body of stream1. You should have wrapped `repeatedly ceate-user` in parenthesis, otherwise the return value of stream1 is the function `create-user`. You'd want to fix the code like this - (defn stream1 [] (repeatedly create-user)) And then, you should call get some users from the stream like this - (take 10 (stream1)) You need to call stream1 like a function because otherwise it'd mean `take`-ing things from a function which doesn't make any sense. If you really want to deal with a stream directly and not call a function, you can bind the stream in a var directly - (def stream (repeatedly create-user)) `repeatedly` returns a lazy sequence so dealing with an infinite sequence is not a problem. Mind you, you're holding on to the head here, so you are still prone to facing stackoverflow errors if you `def` an infinite sequence. user= (defn stream2 [] (repeatedly create-user)) #'user/stream2 user= (take 10 stream2) IllegalArgumentException Don't know how to create ISeq from: user$stream2 clojure.lang.RT.seqFrom (RT.java:494) user= (take 10 (stream2)) ({:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1} {:id 1}) [/code] My question is two parted - what is the different between stream1 and stream2 - what exactly do they return. And, based on that, why doesn't (stream1) return a sequence. In other words, what effect does wrapping the function body in quotes actually do? `stream1` returns just the function `create-user` when invoked. `stream2` return an infinite lazy-sequence of the results of calling `create-user` repeatedly. Hope that helps. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Idiom for transforming a map
Something like this? (into {} (for [[k v] my-map] :when (pred k v) [(transform k) v])) ~BG Sent from phone. Please excuse brevity. On 9 Jan 2013 23:39, Jonathon McKitrick jmckitr...@gmail.com wrote: I have a map derived from JSON data where the keys are strings. I want to build a new map from this one, where the new keys are based on integers extracted from the strings of the old keys by a regex. Not all entries will be transformed into the new map. In Common Lisp, I would LOOP and PUSH entries onto the map, but I need to learn the Clojure way of immutability. What's the best way to create this map? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Auto-indentation not working with clojure-mode 2.0.0
The right key-binding for newline-and-indent is C-j. The current behaviour is correct wrt Emacs key-binding semantics. ~BG Sent from phone. Please excuse brevity. On 1 Jan 2013 15:25, Richard Elliott richard.ellio...@googlemail.com wrote: I've just installed emacs and clojure-mode on a new machine. Out of the box auto-indentation did not work for me. I noticed that in the latest release of clojure-mode.el the RET keybinding has been removed. 1.11 had (define-key map (kbd RET) 'reindent-then-newline-and-indent) 2.0.0 does not I put back in and recompiled clojure-mode.el and autoindentation started to work OK. Not sure if I've done something stupid or found a bug. Can anyone shed any light on this. Here's the change item https://github.com/technomancy/clojure-mode/commit/c2077d48858a507d03cab4416038bd95b70e1464 Thanks -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Map vs Doseq on agents
Because unlike in CL, `map` in Clojure produces a lazy (and possibly infinite) sequence. If the mapping function is impure then laziness makes things harder to reason about. If you want `map` like behaviour but don't want laziness, you can check out `mapv` which returns a vector instead of a lazy sequence and hence is not lazy. -BG On Thu, Dec 27, 2012 at 1:34 PM, Kruno Saho kruno.s...@gmail.com wrote: This code works: (doseq [q @draw-queue] (draw-entity screen q))) This code does not: (map (fn [e] (draw-entity screen e)) @draw-queue) The difference here is that `map` produces no side effects, while `doseq` expects side effects. In Common Lisp, `map` can take side effect creating functions. I am interested why this is not the case in Clojure. Thank You. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: seq? empty? and every?
user= (seq? []) false A vector is not a seq [though it's seq-able]. user= (empty? []) true An empty vector is indeed empty. user= (every? seq? []) true user= (every? empty? []) true every? with any predicate over an empty sequence/collection always returns true. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Little namespace question
Do you have target ns clevolution.version.version0-1-1 required? -BG On Tue, Dec 18, 2012 at 1:38 PM, Alan Shaw noden...@gmail.com wrote: BG, The macro doesn't seem to do the trick. The function X is interned in the target namespace, but: user= (def image (eval-in (X 400 400) clevolution.version.version0-1-1)) CompilerException java.lang.RuntimeException: Unable to resolve symbol: X in this context, compiling:(NO_SOURCE_PATH:1) On Mon, Dec 17, 2012 at 11:53 PM, Alan Shaw noden...@gmail.com wrote: Oh yes, the something.something is fixed so I can just prepend it, thanks. (Hadn't noticed your macro takes the ns as a string!) -A On Mon, Dec 17, 2012 at 11:47 PM, Baishampayan Ghose b.gh...@gmail.com wrote: Alan, What you're asking for is to derive the ns clojure.core given only core. Not sure if that's possible. The namespace constitutes the whole dotted structure and not just the last component, I am afraid. If the actual ns is something.something.version-0-1-1, then you need the string something.something.version-0-1-1 and not just version-0-1-1 [unless of course you have some other way of deriving it from info that's embedded in _your_ code or structure thereof]. -BG On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw noden...@gmail.com wrote: Thanks BG, I'm trying that. But I don't think it addresses how to get from the string version-0-1-1 to the namespace something.something.version-0-1-1. How can I do that? -A On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose b.gh...@gmail.com wrote: Alan, Something like this might work for you - (defmacro eval-in Eval a Clojure form in a different namespace and switch back to current namespace. Args: code - Clojure form as string ns - Target namespace as string [code ns] `(do (in-ns '~(symbol ns)) (let [ret# (eval '~(read-string code))] (in-ns '~(ns-name *ns*)) ret#))) Warning - I haven't really tested this code. -BG On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com wrote: Thanks, Las! Ok say I have a file in which there is string such as (- (atan (bw-noise 902 2 0.7604615575402431 400 400)) (read-image-from-file \images/Dawn_on_Callipygea.png\)) and another version-0-0-1 and I have a namespace version-0-0-1 into which functions named atan etc. are all :referred. I want to evaluate the expression in that particular context, and not remain there when I'm done. -A On Mon, Dec 17, 2012 at 11:00 PM, László Török ltoro...@gmail.com wrote: ah, sorry, it's a bit early for me (in-ns (ns-name user-ns)) if you could post a simple example for the second part of your question I maybe able to help. Las Alan Shaw 2012. december 18., kedd napon a következőt írta: Ah no, that puts me in a new user-ns namespace! Not what I wanted! On Mon, Dec 17, 2012 at 10:51 PM, László Török ltoro...@gmail.com wrote: Try (in-ns 'user-ns) Las On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote: user= *ns* #Namespace user user= (def user-ns *ns*) #'user/user-ns user= user-ns #Namespace user user= (in-ns user-ns) ClassCastException clojure.lang.Namespace cannot be cast to clojure.lang.Symbol clojure.lang.RT$1.invoke (RT.java:226) It appears I'm not understanding how namespaces are represented. Also, is it just wrong of me to want to remember a namespace I was working in and try to go back to it later? The slightly larger context is: I'm saving an s-expression with unqualified names in it into a file as a string. Also saving a string indicating the name of the environment in which that string should be (read and) eval'ed so that the names will resolve to the appropriate functions. Advice on managing this would be appreciated. -Alan Shaw -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google
Re: Little namespace question
Alan, Something like this might work for you - (defmacro eval-in Eval a Clojure form in a different namespace and switch back to current namespace. Args: code - Clojure form as string ns - Target namespace as string [code ns] `(do (in-ns '~(symbol ns)) (let [ret# (eval '~(read-string code))] (in-ns '~(ns-name *ns*)) ret#))) Warning - I haven't really tested this code. -BG On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com wrote: Thanks, Las! Ok say I have a file in which there is string such as (- (atan (bw-noise 902 2 0.7604615575402431 400 400)) (read-image-from-file \images/Dawn_on_Callipygea.png\)) and another version-0-0-1 and I have a namespace version-0-0-1 into which functions named atan etc. are all :referred. I want to evaluate the expression in that particular context, and not remain there when I'm done. -A On Mon, Dec 17, 2012 at 11:00 PM, László Török ltoro...@gmail.com wrote: ah, sorry, it's a bit early for me (in-ns (ns-name user-ns)) if you could post a simple example for the second part of your question I maybe able to help. Las Alan Shaw 2012. december 18., kedd napon a következőt írta: Ah no, that puts me in a new user-ns namespace! Not what I wanted! On Mon, Dec 17, 2012 at 10:51 PM, László Török ltoro...@gmail.com wrote: Try (in-ns 'user-ns) Las On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote: user= *ns* #Namespace user user= (def user-ns *ns*) #'user/user-ns user= user-ns #Namespace user user= (in-ns user-ns) ClassCastException clojure.lang.Namespace cannot be cast to clojure.lang.Symbol clojure.lang.RT$1.invoke (RT.java:226) It appears I'm not understanding how namespaces are represented. Also, is it just wrong of me to want to remember a namespace I was working in and try to go back to it later? The slightly larger context is: I'm saving an s-expression with unqualified names in it into a file as a string. Also saving a string indicating the name of the environment in which that string should be (read and) eval'ed so that the names will resolve to the appropriate functions. Advice on managing this would be appreciated. -Alan Shaw -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- László Török -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Little namespace question
Alan, What you're asking for is to derive the ns clojure.core given only core. Not sure if that's possible. The namespace constitutes the whole dotted structure and not just the last component, I am afraid. If the actual ns is something.something.version-0-1-1, then you need the string something.something.version-0-1-1 and not just version-0-1-1 [unless of course you have some other way of deriving it from info that's embedded in _your_ code or structure thereof]. -BG On Tue, Dec 18, 2012 at 1:10 PM, Alan Shaw noden...@gmail.com wrote: Thanks BG, I'm trying that. But I don't think it addresses how to get from the string version-0-1-1 to the namespace something.something.version-0-1-1. How can I do that? -A On Mon, Dec 17, 2012 at 11:26 PM, Baishampayan Ghose b.gh...@gmail.com wrote: Alan, Something like this might work for you - (defmacro eval-in Eval a Clojure form in a different namespace and switch back to current namespace. Args: code - Clojure form as string ns - Target namespace as string [code ns] `(do (in-ns '~(symbol ns)) (let [ret# (eval '~(read-string code))] (in-ns '~(ns-name *ns*)) ret#))) Warning - I haven't really tested this code. -BG On Tue, Dec 18, 2012 at 12:37 PM, Alan Shaw noden...@gmail.com wrote: Thanks, Las! Ok say I have a file in which there is string such as (- (atan (bw-noise 902 2 0.7604615575402431 400 400)) (read-image-from-file \images/Dawn_on_Callipygea.png\)) and another version-0-0-1 and I have a namespace version-0-0-1 into which functions named atan etc. are all :referred. I want to evaluate the expression in that particular context, and not remain there when I'm done. -A On Mon, Dec 17, 2012 at 11:00 PM, László Török ltoro...@gmail.com wrote: ah, sorry, it's a bit early for me (in-ns (ns-name user-ns)) if you could post a simple example for the second part of your question I maybe able to help. Las Alan Shaw 2012. december 18., kedd napon a következőt írta: Ah no, that puts me in a new user-ns namespace! Not what I wanted! On Mon, Dec 17, 2012 at 10:51 PM, László Török ltoro...@gmail.com wrote: Try (in-ns 'user-ns) Las On Dec 18, 2012 7:50 AM, Alan Shaw noden...@gmail.com wrote: user= *ns* #Namespace user user= (def user-ns *ns*) #'user/user-ns user= user-ns #Namespace user user= (in-ns user-ns) ClassCastException clojure.lang.Namespace cannot be cast to clojure.lang.Symbol clojure.lang.RT$1.invoke (RT.java:226) It appears I'm not understanding how namespaces are represented. Also, is it just wrong of me to want to remember a namespace I was working in and try to go back to it later? The slightly larger context is: I'm saving an s-expression with unqualified names in it into a file as a string. Also saving a string indicating the name of the environment in which that string should be (read and) eval'ed so that the names will resolve to the appropriate functions. Advice on managing this would be appreciated. -Alan Shaw -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- László Török -- 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
Re: Confused about comp
The apply is needed here because filter is going to return a sequence of strings and you really want to `apply' str on it. -BG On Sat, Dec 15, 2012 at 1:39 PM, Peter West peter.b.w...@gmail.com wrote: A couple of questions, if I may. In (partial apply str) why the apply? Given the apply, why the partial? -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Confused about comp
An example will make it clear for you... (str some-lazy-seq) = (str '(foo bar baz)) (apply str some-lazy-seq) = (str foo bar baz) Hope this helps. -BG On Sat, Dec 15, 2012 at 3:48 PM, Peter West peter.b.w...@gmail.com wrote: Thanks Baishampayan. I'm still puzzled about this though, because (doc str) says that with one argument x, str returns x.toString(). What it returns is clojure.lang.LazySeq@fe1 So it seems to be returning a lazy sequence. Why is the function not simply applied? Other functions are applied simple by expressing their form. On Saturday, 15 December 2012 18:52:26 UTC+10, Baishampayan Ghose wrote: The apply is needed here because filter is going to return a sequence of strings and you really want to `apply' str on it. -BG On Sat, Dec 15, 2012 at 1:39 PM, Peter West peter@gmail.com wrote: A couple of questions, if I may. In (partial apply str) why the apply? Given the apply, why the partial? -- Baishampayan Ghose b.ghose at gmail.com -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: list of lists to list of arguments
How about using apply? For example - (sql/with-connection (db-connection) (apply sql/insert-values table-name [id val] [[2 B][3 C]])) Does that work? -BG On Thu, Dec 6, 2012 at 4:48 PM, Amir Wasim amir.wa...@gmail.com wrote: I am trying to use insert-values with value-groups which works like the following (sql/with-connection (db-connection) (sql/insert-values table-name [id val] [2 B][3 C])) here [2 B][3 C] is with two value groups the problem is i have list of list [[2 B][3 C]] and i want to convert it (flatten) [2 B][3 C] because (sql/with-connection (db-connection) (sql/insert-values table-name [id val] [[2 B][3 C]])) doesn't works and throws the following exception SQLException Invalid column type oracle.jdbc.driver. OraclePreparedStatement.setObjectCritical (OraclePreparedStatement.java:8516) does anyone have an idea how i can convert list of lists [[2 B][3 C]] To list of items [2 B][3 C] -- Baishampayan Ghose b.ghose at gmail.com -- 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
Clojure/ClojureScript Spotting
Hi, I was checking out the new GoPanda2 client for IGS (Internet Go Server) and I was pleasantly surprised to discover that the app is actually written in Clojure ClojureScript - http://www.pandanet-igs.com/communities/gopanda/100/ They don't mention Clojure anywhere, but it's quite easy to figure out with a little bit of sniffing around :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Arity problem with multi-methods
Christian, defmulti has defonce-like semantics which I guess is to prevent the associated defmethods from being wiped out when the form is recompiled. Cite - https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L1622 -BG On Wed, Nov 21, 2012 at 11:45 PM, Christian Sperandio christian.speran...@gmail.com wrote: Thank you ! I became crazy because I didn't see the problem in my code. Why is there this issue with multi-methods? (and not with standard functions) Chris Le 22 nov. 2012 à 02:34, grinnbearit sidhant.godiw...@gmail.com a écrit : Hi Chris, If you change multimethod arities you'll have to def the multimethod to nil or restart the swank/nrepl server. It doesn't update that on recompilation. Sidhant On Thursday, November 22, 2012 3:44:10 AM UTC+5:30, Christian Sperandio wrote: Hi, I try to define multi-methods but when I call one I get an exception. I declared the multi-methods like below: (defmulti new-food-item (fn [food expiration] (if (number? expiration) ::duration ::expiration-date))) (defmethod new-food-item ::duration [food expiration-duration] (let [expiration-date (GregorianCalendar.)] (.add expiration-date GregorianCalendar/DAY_OF_MONTH expiration-duration) {:name food :expiration-date expiration-date})) (defmethod new-food-item ::expiration-date [food expiration-date] {:name food :expiration-date expiration-date}) And when I do: (new-food-item tomatoes 5) I get this exception: ArityException Wrong number of args (2) passed to: core$class clojure.lang.AFn.throwArity (AFn.java:437) I don't understand where is the problem :/ Some help? Thank you. Chris -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Request for a hint
Hi Milen, The function `conj` conjoins an item into a Clojure collection. In your case, you need to define both `coll` and `item` for the example to work. Consider these examples - (conj [1 2 3] 4) (conj '(1 2 3) 4) (conj #{1 2 3} 4) (def coll [1 2 3 4 5]) (def item 6) (conj coll item) etc. I hope that helps. -BG On Sat, Nov 17, 2012 at 10:15 AM, Milen Ivanov milen.iva...@gmail.comwrote: Dear All, I am trying to make sense of Closure by reading the book Programming Closure, 2nd Eddition. I persistently get booed at one of the very first lines of code in the book: (conj coll item) The listing (rather short) is below. May I please ask you for some hint because beginner's luck seems to have gone missing in this case. Thanks in advance! Milen milen@linux-oaty:~ cd ~/Dropbox/Clojure/clojure-1.4.0/ milen@linux-oaty:~/Dropbox/Clojure/clojure-1.4.0 java -cp clojure-1.4.0.jar clojure.main Clojure 1.4.0 user= (conj coll item) CompilerException java.lang.RuntimeException: Unable to resolve symbol: coll in this context, compiling:(NO_SOURCE_PATH:1) user= (pst) CompilerException java.lang.RuntimeException: Unable to resolve symbol: coll in this context, compiling:(NO_SOURCE_PATH:1) clojure.lang.Compiler.analyze (Compiler.java:6281) clojure.lang.Compiler.analyze (Compiler.java:6223) clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3548) clojure.lang.Compiler.analyzeSeq (Compiler.java:6457) clojure.lang.Compiler.analyze (Compiler.java:6262) clojure.lang.Compiler.analyze (Compiler.java:6223) clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:5618) clojure.lang.Compiler$FnMethod.parse (Compiler.java:5054) clojure.lang.Compiler$FnExpr.parse (Compiler.java:3674) clojure.lang.Compiler.analyzeSeq (Compiler.java:6453) clojure.lang.Compiler.analyze (Compiler.java:6262) clojure.lang.Compiler.eval (Compiler.java:6508) Caused by: RuntimeException Unable to resolve symbol: coll in this context clojure.lang.Util.runtimeException (Util.java:170) clojure.lang.Compiler.resolveIn (Compiler.java:6766) clojure.lang.Compiler.resolve (Compiler.java:6710) clojure.lang.Compiler.analyzeSymbol (Compiler.java:6671) clojure.lang.Compiler.analyze (Compiler.java:6244) clojure.lang.Compiler.analyze (Compiler.java:6223) nil user= -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure to Haskell Compiler
Ahmed, You're grossly underestimating the effort needed to accomplish something like that. Why don't you look at your Clojure code and figure out ways of optimizing that instead? -BG On Sat, Nov 17, 2012 at 1:31 PM, Ahmed Shafeeq Bin Mohd Shariff sepultura.tri...@gmail.com wrote: Hi guys, I've been frustrated with Clojure's slow speed on the JVM. I've been thinking of how it can be compiled to native and I feel that compiling Clojure to Haskell and then using ghc to convert this to native would be a good idea since Haskell has a large set of good libraries. What do you guys think? Would this be a fruitful endeavor for me to embark on? -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Can't dynamically bind non-dynamic var
Check out 'with-redefs' in clojure.core. -BG Sent from phone. Please excuse brevity. On 16 Nov 2012 08:02, faenvie fanny.aen...@gmx.de wrote: hi clojure-users, for testing an app that uses quil, i want to mock out some function-calls to the quil-library ... when i do it like this: (ns myapp (:use clojure.test) (:require [quil.core :as q])) (deftest (binding [q/height (fn [] 400)] (is 400 (q/height i get an Exception that says: actual: java.lang.IllegalStateException: Can't dynamically bind non-dynamic var: quil.core/height Any hints, how this an be solved or circumvented ? thanks have a successful day -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Anonymous Macros
Take a look at tools.macro/macrolet. https://github.com/clojure/tools.macro/ Regards, BG Sent from phone. Please excuse brevity. On 6 Nov 2012 19:10, Sean Neilan s...@seanneilan.com wrote: I was hoping to write a macro inside of a let statement. The macro would be returned from the let and keep closures to whatever was defined in the let. Also, if possible, define multiple global macros inside of a let statement so it's as if the let is returning multiple values. On Tue, Nov 6, 2012 at 9:07 PM, jaime xiejianm...@gmail.com wrote: May I know in what circumstances would an anonymous macro be applied? - I just don't think there's a way to define anonymous macro but maybe we can make a workaround by manipulating the macro syntax... 在 2012年11月7日星期三UTC+8上午8时17分37秒,Sean Neilan写道: Is there any way to write an anonymous macro in Clojure? This post: http://stackoverflow.com/**questions/4074961/anonymous-** macros-in-clojurehttp://stackoverflow.com/questions/4074961/anonymous-macros-in-clojure says it's possible with some hacks and in version 1.3 Clojure will have some kind of support for this. Thank you for your time. -Sean -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Is game development Clojure(functional in general) friendly?
Titon, Not Clojure, but this blog series will give you an idea about how to implement games of the Tetris sort in a FP language - http://prog21.dadgum.com/23.html Regards, BG On Tue, Oct 30, 2012 at 12:00 AM, titon barua titani...@gmail.com wrote: Hi, I am very new to Clojure and functional programming in general. I am game development enthusiast(although did nothing more than a tetris clone in python and C). As far as i've seen OpenGL, it's mostly state manipulation and seems to me like completely against Clojure's philosophy. Could there exist some kind of magic that makes all the state manipulations disappear? By the way, I think Clojure's concurrency capabilities can upsurge a new era for game development as GigaHertz war have pretty much stopped and game developers are still reluctant to use full capabilities of multi-core hardware. Perhaps they didn't discover clojure yet? (: I for one would like some good and maintained wrappers for input and graphics in Clojure - like SDL and OpenGL. Disclaimer: I am a wannabe game dev chained to internet/web paradigm for financial reasons ... :( -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Check that a protocol exists
What about the technique Clojure uses in the reducers library? https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L37 -BG On Wed, Oct 24, 2012 at 12:20 PM, Michael Klishin michael.s.klis...@gmail.com wrote: Is there a way to check if a protocol exists? For example, if I want to extend clojure.data.json protocols but only if it is available, how would I go about it? This way does not work at least some of the time (referenced namespace causes a ClassNotFound exception during compilation): https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33 Any better solutions? I'd like to avoid adding any new dependencies, if possible. Thank you in advance. -- MK http://github.com/michaelklishin http://twitter.com/michaelklishin -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Cdr car
`car` is called `first` here and `cdr` could mean either `rest` or `next` depending on what you mean/need. And oh, `cons` is not exactly the same one from Common Lisp, etc. Regards, BG On Tue, Oct 16, 2012 at 3:40 PM, Curtis cur...@ram9.cc wrote: Hello - I was familar with lisp years ago and am very new to clojure. I am having a hard time understanding how to find 'car' and 'cdr'. The nice thing about these functions is they always seem to be a part of lisp. I would like to use the little lisper to teach lisp to my co-workers so that we can adopt Clojure. How can i import cdr or car? I know i can write these manually or alias them to 'first' and 'rest' - are they a part of the language? Cons appears to be around. -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure turns 5
That's huge! Time flies. Happy Birthday Clojure and thank you very much Rich for creating Clojure and fostering this amazing community. Regards, BG On Tue, Oct 16, 2012 at 6:54 PM, Rich Hickey richhic...@gmail.com wrote: I released Clojure 5 years ago today. It's been a terrific ride so far. Thanks to everyone who contributes to making Clojure, and its community, great. Rich -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: core.logic Go solver
Must say, you sir have written some very interesting code there! Regards, BG On Thu, Oct 4, 2012 at 10:53 PM, nchurch nchubr...@gmail.com wrote: Here's a Go solver code: https://github.com/nchurch/go/blob/master/src/go/core.clj README: https://github.com/nchurch/go It's a really fun use of core.logic: you can test for pieces being alive or dead; you can also generate all the boards that make a given piece alive or dead. See the README. There are some issues that I'd like to get input on. For one thing, I've used mutual recursion (as the Wiki article on mutual recursion says, Prolog depends on mutual recursion); I don't see any straightforward and clean way to eliminate it (you can't just trampoline). Probably because of this, you can't generate boards bigger than 15X15. Also, there's an interesting discrepancy between generating alive-for boards and dead-for boards which I don't quite understand; in the case of dead boards, the unification ends up outputting nil for any piece that helps kill the piece in question. OK, I have to stop now: Core.logic is terribly addictive. -- 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 -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: how do we go about promoting new clojure libraries?
On Wed, Sep 26, 2012 at 12:35 PM, Michael Klishin michael.s.klis...@gmail.com wrote: Unfortunately, yes. Clojure uses a fine crafted 16th century contributor agreement process that does not take into account that there may be potential contributors outside of North America and western Europe. Please cast your vote in https://groups.google.com/forum/?fromgroups=#!searchin/clojure/evolving$20the$20clojure/clojure/GnfAK6beMN8/DiMIbvYWhVkJ so it can be replaced with something that makes sense in the year 2012. Michael, IMHO it's not that archaic. There are _many_ FOSS projects which mandate a CLA of some sort (even the hippest projects like Node.js have this http://nodejs.org/cla.html). The only contention is the snail-mailing part, which I understand is cumbersome. Chef guys have opted to use Echosign for the signing purpose (http://wiki.opscode.com/display/chef/How+to+Contribute) and I think it's a decent compromise. Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: how do we go about promoting new clojure libraries?
On Wed, Sep 26, 2012 at 12:40 PM, Michael Klishin michael.s.klis...@gmail.com wrote: No, that's not how it works. You *first* make contribution process easy, *then* ask people to volunteer. Michael, Don't want to sound snarky here, but as we all know, easy != simple :) Regards, BG -- Baishampayan Ghose b.ghose at gmail.com -- 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