Re: fixing web docs

2011-03-30 Thread Devin Walters
Dare I mention the idea of an official (or semi-official) Clojure documentation project that ties together the disparate sources that currently exist? What say you, community? There is a lot of information out there that simply needs to be placed in the right bucket in order for it to be

Re: fixing web docs

2011-03-30 Thread Nick Zbinden
Dare I mention the idea of an official (or semi-official) Clojure documentation project that ties together the disparate sources that currently exist? What say you, community? I was thinking about something. This is just an idea spil I didn't do anything jet. Kind of like a learning

Re: Leiningen capabilities (was Re: A newbie's summary - what worked, what didn't)

2011-03-30 Thread Mike Meyer
On Tue, 29 Mar 2011 16:49:48 -0700 (PDT) Phil Hagelberg p...@hagelb.org wrote: On Mar 28, 10:24 pm, Andy Fingerhut andy.finger...@gmail.com wrote: And I should have known about this before, but had not used it.  It adds to Leiningen the capability to search, and I'm not sure, but perhaps

Re: Macro compile vs run time, appengine-magic defentity

2011-03-30 Thread Thorsten Wilms
On 03/29/2011 10:51 PM, Meikel Brandmeyer wrote: [(with-meta key {:key true})] do not set ID/name. Which Clojure version are you using? If it is 1.2, try (with-meta key {:tag :key}). Clojure 1.2 and your are correct, thanks. I added a comment to remember that variant, for when I switch

Re: fixing web docs

2011-03-30 Thread Ambrose B
On Wed, Mar 30, 2011 at 5:28 PM, Nick Zbinden nick...@gmail.com wrote: Dare I mention the idea of an official (or semi-official) Clojure documentation project that ties together the disparate sources that currently exist? What say you, community? I was thinking about something. This is just

Re: int or long as map key

2011-03-30 Thread Stuart Sierra
Looks like that bit is not finished yet. See http://dev.clojure.org/display/doc/Enhanced+Primitive+Support under hash maps and sets now use = for keys -S -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: using clojure for (java) code generation; advice sought

2011-03-30 Thread Stuart Sierra
Take a look at http://www.stringtemplate.org/ for a Turing-complete, purely-functional, Java-based template language designed for code generation. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group,

updating a map value

2011-03-30 Thread Jeff Rose
Hola, I'm looking for a function that updates a map value by calling a function on it. (def foo {:a 1}) So instead of this: (assoc foo :a (inc (:a foo))); = {:a 2} Something like this: (map-fn foo :a inc); = {:a 2} Does that exist somewhere, or should

Re: updating a map value

2011-03-30 Thread Alan
(update-in foo [:a] inc). It also works for nested maps, the same way assoc-in and get-in do. On Mar 30, 10:21 am, Jeff Rose ros...@gmail.com wrote: Hola,   I'm looking for a function that updates a map value by calling a function on it. (def foo {:a 1}) So instead of this:   (assoc foo

Re: updating a map value

2011-03-30 Thread Mike Meyer
On Wed, 30 Mar 2011 10:21:41 -0700 (PDT) Jeff Rose ros...@gmail.com wrote: Hola, I'm looking for a function that updates a map value by calling a function on it. (def foo {:a 1}) So instead of this: (assoc foo :a (inc (:a foo))); = {:a 2} Something like this:

from string to keyword?

2011-03-30 Thread Avram
hi, I have 2 report files in JSON format like below: # file 1: a.json { abcdef : { value : 10 } # file 2: b.json { abcdef : { value : 20 } I am using clojure.contrib.json to read each file, and I want a function that takes in the 2 structures and a metric name (e.g. abcdef). The function will

Re: from string to keyword?

2011-03-30 Thread Alan
(keyword abcdef) = :abcdef (defn metric-diff [metric json-objs] (apply - (map (comp :value (keyword metric)) json-objs))) Probably does what you want. On Mar 30, 12:04 pm, Avram aav...@me.com wrote: hi, I have 2 report files in JSON format like below: # file 1: a.json { abcdef : {

Re: from string to keyword?

2011-03-30 Thread Avram
Many thanks! On Mar 30, 12:11 pm, Alan a...@malloys.org wrote: (keyword abcdef) = :abcdef (defn metric-diff [metric json-objs]   (apply - (map (comp :value (keyword metric)) json-objs))) Probably does what you want. On Mar 30, 12:04 pm, Avram aav...@me.com wrote: hi, I have 2

Re: from string to keyword?

2011-03-30 Thread Stuart Sierra
clojure.contrib.json (or the new clojure.data.json) has an option to *not* convert JSON Object keys into keywords. I still think that should be the default, but I was out-shouted. -Stuart Sierra clojure.com -- You received this message because you are subscribed to the Google Groups Clojure

Re: gen-class and state...

2011-03-30 Thread Stuart Sierra
On Sunday, March 27, 2011 6:17:59 AM UTC-4, Stefan Sigurdsson wrote: How do you guys normally manage resources when using lazy sequences? You have to manage resources at a larger scope that encompasses all your use of the lazy sequence. The quick-and-dirty solution is to use `doall` inside

Re: fixing web docs

2011-03-30 Thread Sean Corfield
On Tue, Mar 29, 2011 at 6:56 PM, Rayne disciplera...@gmail.com wrote: I think emailing me or telling me on IRC or twitter or one of the other easily found and plentiful ways to get a hold of me is much better than complaining about it as if it were something that is impossible to fix. I

Re: from string to keyword?

2011-03-30 Thread Avram
One more thing… If I try this, it looks okay user= (Integer/parseInt (:value (j1 (keyword abcdef 10 But within the function, I get cast exceptions. user= j1 {:abcdef {:value 10}} user= j2 {:abcdef {:value 20}} user= (defn metric-diff [metric json-objs] (apply - (map (comp

Re: from string to keyword?

2011-03-30 Thread Avram
Perfect. Thanks again. -A On Mar 30, 3:17 pm, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 31.03.2011 um 00:02 schrieb Avram: user= (defn metric-diff [metric json-objs]    (apply - (map (comp (Integer/parseInt :value) (keyword metric)) json-objs))) (defn metric-diff   [metric

Re: (memoize) and recursive functions (Clojure 1.2)

2011-03-30 Thread Ken Wesson
On Wed, Mar 30, 2011 at 12:02 PM, Laurent PETIT laurent.pe...@gmail.com wrote: Except in 1.3 it will be a little bit harder to do throw-away per-thread memoizes for vars you do no own if their author didn't make their holding var :dynamic ('cause then you will not be able to rebind them).

Re: fixing web docs

2011-03-30 Thread Phil Hagelberg
On Mar 29, 10:56 pm, Nick Zbinden nick...@gmail.com wrote: One more thing people should do is update there blogs. I know its stupid work but I should be done. Its extremly confusing when google for something. Update your blog with a little notice or update it that it is correct again.

Re: using clojure for (java) code generation; advice sought

2011-03-30 Thread Eli Barzilay
On Tue, Mar 29, 2011 at 4:43 PM, B Smith-Mannschott wrote: Horrible hack, maybe, but it got me thinking. What you seem to be doing is moving between code and literal mode by quoting with #. This is a little like traditional quasi-quote... And that got me thinking about Scribble [1] again.  In