On Wednesday, March 30, 2011 7:29:42 PM UTC+2, Mike Meyer wrote:
>
> On Wed, 30 Mar 2011 10:21:41 -0700 (PDT)
> Jeff Rose 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:
> > (ass
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] ag
On Mar 29, 10:56 pm, Nick Zbinden 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.
Excellent point.
On Wed, Mar 30, 2011 at 12:02 PM, Laurent PETIT 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).
>
> This is close to b
Perfect. Thanks again.
-A
On Mar 30, 3:17 pm, Meikel Brandmeyer 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 & j
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 & json-objs]
(apply - (map (comp #(Integer/parseInt %) :value (keyword metric))
json-objs))
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 (In
Yup. After seeing this thread start up, I went back thru my handful of
Clojure posts and double-checked links and examples (and found my post
about getting started with Leiningen no longer worked in some places
and provided different output in others - so I fixed it). Keeping
seven and a half years
On Tue, Mar 29, 2011 at 6:56 PM, Rayne 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 tweeted it was down with
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` ins
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"
Many thanks!
On Mar 30, 12:11 pm, Alan 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 wrote:
>
>
>
> > hi,
>
> > I have 2 report files
(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 wrote:
> hi,
>
> I have 2 report files in JSON format like below:
>
> # file 1: a.json
> { "abcdef" : { "value
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 fu
On Wed, 30 Mar 2011 10:21:41 -0700 (PDT)
Jeff Rose 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:
> (map-fn fo
(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 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 (:
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
2011/3/29 Mike Meyer
> On Mon, 28 Mar 2011 20:50:05 -0400
> James Reeves wrote:
>
> > > Ah, but as in Java, the "big official libraries" such as java itself
> > > starts with i.e. java.swing. But if I was to publish a utilities
> > > library for swing, i would call it no.terjedahl.java.swing, s
On Sat, Mar 26, 2011 at 10:54 PM, ultranewb wrote:
>
> I guess the optimum solution I see for myself at this point is getting
> Clojure Box to talk to ClojureW (i.e. editing a source file with
> Clojure Box, then "running" that source inside some Emacs window by
> running clj). I'm guessing this
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).
This is close to being a problem for paredit.clj (not tested yet), but
hopefully I'
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, se
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 clojur
On Wed, Mar 30, 2011 at 5:28 PM, Nick Zbinden 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 an idea spi
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 ver
On Tue, 29 Mar 2011 16:49:48 -0700 (PDT)
Phil Hagelberg wrote:
> On Mar 28, 10:24 pm, Andy Fingerhut 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 also add
> > dependencies that were f
> 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 assis
26 matches
Mail list logo