This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-11-07
Channels
- # alda (7)
- # beginners (4)
- # boot (108)
- # cljsrn (40)
- # clojure (24)
- # clojure-berlin (1)
- # clojure-dev (20)
- # clojure-russia (21)
- # clojurescript (115)
- # clojurescript-ios (1)
- # cursive (8)
- # data-science (5)
- # datascript (3)
- # hoplon (313)
- # jobs (1)
- # ldnclj (2)
- # off-topic (19)
- # om (115)
- # portland-or (3)
- # re-frame (9)
- # yada (2)
@triss look up how to do it in Java and use interop to do that
I'm experimenting with the specter library and am trying to select a list of values for a given key anywhere it may occur in a map (including nested maps and vectors of maps, etc) with the intention of applying a transform function to it (say keyword
). So, for example, given the map: {:a "one" :b {:a "two" :c "foo"} :d [{:a "three"} {:e "bar"}]}
I want all values of :a
["one" "two" "three"], and then transform these with keyword
so that the final map has :one :two :three in their place. Thoughts?
@manderson: that should like a postwalk traversal, can specter do that?
@jfntn: not sure. I may have the wrong library for the use case as I wasn't able to find a nice way to do it, but thought I'd check here in case I was missing something.
@manderson: well in this case you should check clojure.walk/postwalk does just what you’re trying to do
for reference, here's a quick solution to my above question using postwalk:
(clojure.walk/postwalk
(fn [form]
(if (and (map? form) (contains? form :a))
(assoc form :a (keyword (:a form)))
form))
{:a "one" :b {:a "two" :c "foo"} :d [{:a "three"} {:e "bar"}]})
Hi, is there an easy way to add a local jar to a leiningen project? Easy as just putting the lib path to leiningen configuration and being done? (No, I don't want to setup a local maven repo or something similar)
@sveri, yes lein-localrepo
@nowprovision: Hm, you mean this one: https://github.com/kumarshantanu/lein-localrepo ? This also requires me to do some local setup. I'd like to omit that, if possible
from http://stackoverflow.com/questions/2404426/leiningen-how-to-add-dependencies-for-local-jars - Just use :resource-paths in your project.clj file. ?
though, i used lein-localrepo to throw the ms-sql driver in the right place, setup was one line to ~/.lein/profiles.clj
Hm, I have been trying to add it to resoure-paths, but the test runner cannof find it. it fails on compilation -.-
@nowprovision: Thanks for helping. I found the lib is available on clojars, been looking on maven repo only
About to do a 1hr talk on intro to Clojure. Anyone recommend a favorite slideset? It's for BarCamp. Mixed crowd
What’s the idiomatic way to get only the first resulting item from applying a transducer to a collection? My current understanding is that:
With (first (into [] xform input))
, the entire result is needlessly processed.
But with (first (sequence xform input))
, a lot of intermediate lazy sequences are needlessly instantiated.