clojure.data diff question

2012-01-13 Thread vitalyper
Clojure (use 'clojure.data) nil Clojure (doc diff) - clojure.data/diff ([a b]) Recursively compares a and b, returning a tuple of [things-only-in-a things-only-in-b things-in-both]. Comparison rules: * For equal a and b, return [nil nil a]. * Maps are subdiffed where keys

Re: Help! Migrating to 1.3.0

2012-01-13 Thread vitalyper
Have seen this as well. For efficiency sake 1.3.0 requires :dynamic meta for convention based ear-muffed vars (intended for rebinding). The warning actually is quite descriptive if you think about it. See more in-depth discussion at

:arglists question

2011-12-29 Thread vitalyper
Came across the following in one of the clojure libs (congomongo to be exact) https://github.com/aboekhoff/congomongo/blob/master/src/somnium/congomongo.clj:464 (defn command Executes a database command. {:arglists '([cmd {:options nil :from :clojure :to :clojure}])} [cmd {:keys [options

clojure.math.combinatorics jar

2011-12-27 Thread vitalyper
Do we have this jar in clojars? Searched for it under math but could not find it. Found version 0.0.2 in mvnrepository.com but it is not the the version 0.0.3-SNAPSHOT mentioned in https://github.com/clojure/math.combinatorics/blob/master/pom.xml -- You received this message because you are

clojure.math.combinatorics jar

2011-12-27 Thread vitalyper
Do we have this jar in clojars? Searched for it under math but could not find it. Found version 0.0.2 in mvnrepository.com but it is not the the version 0.0.3-SNAPSHOT mentioned in https://github.com/clojure/math.combinatorics/blob/master/pom.xml -- You received this message because you are

Re: Get multiple vals from a map

2011-12-07 Thread vitalyper
Thanks, Alan. It is more general solution which also works for keys that are not keywords user= (map {a 1 b 2 c 3} [ a b]) (1 2) On Dec 1, 5:02 pm, Alan Malloy a...@malloys.org wrote: I usually use juxt, but a more correct/robust solution is to use map, with the lookup-map as the function:

Re: Dynamically Loading Jar Strategy

2011-12-07 Thread vitalyper
You can add jar to a classpath at runtime via the hack below. http://groups.google.com/group/clojure/browse_thread/thread/95ea6e918c430e/69c0d195defeeed3?lnk=gstq=classpath#69c0d195defeeed3 HTH On Dec 7, 10:26 am, Pierre-Yves Ritschard p...@spootnik.org wrote: Hi, I have a use case where a

Get multiple vals from a map

2011-12-01 Thread vitalyper
Is there something build in for getting multiple vals out of the map? {:keys [...]} woks in destructuring forms. It is quite easy to build something with filter and map but I suspect these is a common problem somebody solved already. Desired (get-vals [:a :b] {:a 1 :b 2 :c 3}) (1 2) -- You

Re: Get multiple vals from a map

2011-12-01 Thread vitalyper
Thanks, works in my case. On Dec 1, 3:26 pm, Ulises ulises.cerv...@gmail.com wrote: How about using juxt: sandbox ((juxt :foo :bar) {:foo 1 :bar 2 :baz 0}) [1 2] sandbox This only works, however, if you use keywords for keys (as they are functions themselves). U -- You received this

Re: Use of eval

2011-11-22 Thread vitalyper
Gary, You are probably removing try/catch as well. ClassNonFoundException is expected and silenced with catch. (defn cl-factory Returns a Commons Logging-based implementation of the LoggerFactory protocol, or nil if not available. [] (try (Class/forName foo.bar) ; eval removed

Re: Proper parallelism?

2011-11-22 Thread vitalyper
Andy, You can also look into using futures (pmap uses future). In section 11.6.1 of Joy of Clojure there is a recipe how to dispatch multiple RPC calls in parallel using as-futures macro. Obviously, this depends on what you want to do with results of your REST calls. On Nov 22, 11:16 am, AndyK

Re: Use of eval

2011-11-22 Thread vitalyper
Gary, You were right with your initial reply. Sorry I did not get it. Thanks for your help in understanding this. On Nov 22, 1:58 pm, Gary Trakhman gary.trakh...@gmail.com wrote: Also I think this line doesn't actually do anything:  (Class/forName foo.bar) It will effectively just ask the

Re: Change var in other namespace

2011-11-18 Thread vitalyper
this: (binding [*logger-factory* (log-impl/log4j-factory)]  (do-stuff-with-the-logger-factory-rebound)) On Thu, Nov 17, 2011 at 5:17 PM, vitalyper vitaly...@yahoo.com wrote: clojure.tools.logging defines *logger-factory* and initializes it with first logger implementation on the class path

Use of eval

2011-11-18 Thread vitalyper
Came across this code in clojure.tools.logging (defn cl-factory Returns a Commons Logging-based implementation of the LoggerFactory protocol, or nil if not available. [] (try (Class/forName org.apache.commons.logging.Log) (eval `(do (extend

Re: Use of eval

2011-11-18 Thread vitalyper
I don't think you are right - it does compiles without it. After more thinking my guess is that eval is used to combine extend and reify in the same function. Let's see if somebody else could shed a light on this. On Nov 18, 12:45 pm, Gary Trakhman gary.trakh...@gmail.com wrote: My speculation

Change var in other namespace

2011-11-17 Thread vitalyper
clojure.tools.logging defines *logger-factory* and initializes it with first logger implementation on the class path (def ^{:doc An instance satisfying the impl/LoggerFactory protocol. Used internally to obtain an impl/Logger. Defaults to the value returned from impl/ find-factory.