Re: How to configure a library from a file in the project that has it as a dependency?

2016-04-20 Thread Facundo Olano
I've tried carica as squeegee suggested and it worked as I expected. I'm going with that so I can allow both dynamic binding and static config via file. Thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: How to configure a library from a file in the project that has it as a dependency?

2016-04-20 Thread Facundo Olano
I just noticed I replied with a private message earlier > If you end up using a separate config file rather than project.clj, you > might find Carica https://github.com/sonian/carica useful. It allows > merging config files on the classpath into one effective config hierarchy > with

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread JvJ
I don't think I'll go with primitive arrays. A big part of the reason I'm using Clojure is for the immutable persistence. I just want to use them in the most efficient way possible. I know I'm not going to get hyper-blazing C-level performance. On Wednesday, 20 April 2016 15:38:11 UTC-7,

Re: Recur in an overloaded function does not work?

2016-04-20 Thread J.-F. Rompre
Ooops - my apologies (attempted correction below) Here is a horribly contrived example (sorry, that's all I can come up withht now rig) using recur across different arities of the same function, together with trampoline. (defn is-odd? ([n] (cond (< n 0) true (even? n) #(is-odd?

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread Stuart Sierra
The first answer: test & measure. Benchmark your code, use a JVM profiler to find hotspots, etc. Test every change you make to see if it has a measurable improvement. Any assumptions about what “should” be faster/slower are likely to be wrong. The long answer: The JVM does not give you much

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread Raoul Duke
You can only tell by benchmarking. And even then it can change when you move to different hardware. You can debate about big O and constant factors and numa and all that jazz till you are blue in the face. There are 3 kinds of people in the world: 1) those who think we should stick with arrays

Re: Possible to override assoc-in or update-in?

2016-04-20 Thread JvJ
That was actually the example I used to implement this. As it turns out, assoc-in, update-in, etc. work on anything that supports assoc. On Wednesday, 20 April 2016 13:39:40 UTC-7, Andy Fingerhut wrote: > > I don't know if assoc-in etc. work on the clojure.data.priority-map data > structures,

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread JvJ
Do you think that maps vs vectors would make a difference in the transient case? On Wednesday, 20 April 2016 13:42:12 UTC-7, Andy Fingerhut wrote: > > Transients are a performance optimization that can give quite significant > performance increases when you know you will be doing many updates

Re: Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread Andy Fingerhut
Transients are a performance optimization that can give quite significant performance increases when you know you will be doing many updates to a Clojure vector or map. A long sequence of updates on a transient tends to allocate much less memory than the corresponding sequence of updates on a

Re: Possible to override assoc-in or update-in?

2016-04-20 Thread Andy Fingerhut
I don't know if assoc-in etc. work on the clojure.data.priority-map data structures, but your questions at least reminded me of the implementation of that data structure, which uses two maps internally to maintain the priority map, and keeps their contents consistent with each other [1]. It also

Re: Recur in an overloaded function does not work?

2016-04-20 Thread adrian . medina
I don't think you're missing anything James. It does not look like this example uses trampoline with the intended effect. On Wednesday, April 20, 2016 at 2:45:05 PM UTC-4, James Elliott wrote: > > Does trampoline really help in this case? I don’t see where we are ever > returning a new

Re: Recur in an overloaded function does not work?

2016-04-20 Thread James Elliott
Does trampoline really help in this case? I don’t see where we are ever returning a new function for trampoline to call, avoiding a new stack frame. It seems to me no different than simply calling the other arities directly in this example. What am I missing? On Wednesday, April 20, 2016 at

Memory Locality - Maps vs. Vectors vs. Transient Maps & Vectors

2016-04-20 Thread JvJ
I'm writing some code that I would like to perform as quickly as possible. Currently, I am iterating over large hash maps and performing assocs and dissocs. I don't know much about performance optimization, but I am told that memory locality is a big factor. I would like to know how

Re: Possible to override assoc-in or update-in?

2016-04-20 Thread JvJ
I had a bit of trouble fully understanding the EAV concept or the pldb code. There's not a good overview of EAV architecture that doesn't focus on databases. I'm not much of a DB guy. So, I'm not sure if I got the essence of the EAV pattern with my new implementation, but here it is anyway:

Re: Recur in an overloaded function does not work?

2016-04-20 Thread J.-F. Rompre
You can prevent stack consumption by using trampoline for tail-recursive calls to a different arity, and recur for same arity, something like: (defn find-comment-in-line ([s] (when (pos? (count s)) (if-let [cs (seq (comment-s? s))] ;; yes, a comment symbol found, ;;

Re: Recur in an overloaded function does not work?

2016-04-20 Thread J.-F. Rompre
You can prevent stack consumption by using trampoline for tail-recursive calls to a different arity, and recur for same arity, something like: (defn find-comment-in-line ([s] (when (pos? (count s)) (if-let [cs (seq (comment-s? s))] ;; yes, a comment symbol found, ;;

Re: Incanter 1.9 and Clojure 1.7

2016-04-20 Thread Bruce Durling
Myriam, Would you check with the latest commit on the develop branch please? We're trying to get a new SNAPSHOT release out that might sort a number of issues. If yours isn't sorted then I might look at it as we use PCA a fair bit too. Do you have a small example of some code that is failing?

cljs-ajax question

2016-04-20 Thread ru
Hi, cljs-ajax transforms vector parameter into map during transfer like this: [40.328 -68.348] -> { 0 40.328, 1 -68.348}. What does it mean and how avoid this? Thanks. Sincerely, Ru -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Incanter 1.9 and Clojure 1.7

2016-04-20 Thread myriam abramson
I am getting the following error with Incanter 1.9 running the PCA example from the documentation: CompilerException java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number, compiling:(pca.clj:17:10) That works fine with Clojure 1.6. (and yes, I know that the latest is

Re: How to configure a library from a file in the project that has it as a dependency?

2016-04-20 Thread Leon Grapenthin
It's very simple: Leave configuration file management and stuff out of the lib. Instead, pass the translations dictionary to your library as an argument. On your app level, you could still load the desired dictionary from a config file but the lib should stay independent of this. On