Re: cut Conj costs, share rooms/cars/vessels

2010-10-07 Thread braver
OK, so I reserved a Conj Hilton room with double beds for 10/21-23, two nights at $99, with tax $227. If a fellow clojurer wants to save $110, email me directly! -- Alexy -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send em

cut Conj costs, share rooms/cars/vessels

2010-10-06 Thread braver
Greetings -- I'm paying my way to Conj and would like to split the hotel with someone who doesn't snore! Driving is probably too far from NH, but in case you sail your boat down the coast, I'd like to jump in, too. Let's split the room at least! Cheers, Alexy -- You received this message becau

Re: building new contrib against a specific clojure jar

2010-09-02 Thread braver
On Sep 2, 5:24 pm, Stuart Sierra wrote: > You'll need to adjust the version numbers for the Clojure > dependencies.  These are configured in clojure-contrib/modules/parent/ > pom.xml at the line: > >   >     1.2.0 > > Change that to 1.3.0-SNAPSHOT for the latest snapshot (including the > ones you

building new contrib against a specific clojure jar

2010-09-02 Thread braver
I usually git pull clojure, ant, mvn install, then git pull and build clojure-contrib against it. There used to be a -Dclojure.jar=... option mentioned in README.txt for the contrib. The new modular version, however, doesn't mention it, just saying, use these contrib versions for those clojure on

faster json extraction?

2010-06-23 Thread braver
While writing JSON is fast, reading it back into a Clojure map is slow; even with clj-json, based on Jackson. Here's an idea: use Jackson's ObjectMapper. The following line extracts a Java Map: Map userData = mapper.readValue(new File("user.json"), Map.class) (from http://wiki.fasterxml.com/Jac

Re: functional check slower than imperative?

2010-05-19 Thread braver
On May 18, 11:45 am, Christophe Grand wrote: > (defn sorted-by? [pred s] >   (if-let [ns (next s)] >     (let [[a b] s] >       (and (pred a b) (recur pred ns))) >     true)) > (defn reps-sorted2? [dreps] >  (every? #(sorted-by? >= (map first (val %))) dreps)) > > and it should be as fast as the

Re: functional check slower than imperative?

2010-05-19 Thread braver
Christophe -- thanks for the wonderful tuning! I build my graph using sorted-map for the nested maps, i.e. adjacency lists. Then it's dumped to disk via jiraph, serializing the adjacency lists with Google Protocol Buffers, and loaded back from them. The question I had was whether the sorting ord

Re: functional check slower than imperative?

2010-05-18 Thread braver
On May 18, 10:47 am, "Heinz N. Gies" wrote: > Out of curiosity, can you remove the pmap and run them in the opposite order? > as first (time (reps-sorted1? dreps)) then (time (reps-sorted2? dreps))? user=> (time (reps-sorted1? dreps)) "Elapsed time: 8254.967 msecs" true (defn reps-sorted2? [drep

Re: functional check slower than imperative?

2010-05-18 Thread braver
On May 18, 10:27 am, David Nolen wrote: > On Tue, May 18, 2010 at 10:18 AM, braver wrote: > The documentation is pretty clear about how pmap works. Your work needs to > be greater than the coordination overhead. You probably need to batch your > work before trying to call pmap. D

functional check slower than imperative?

2010-05-18 Thread braver
I have a huge graph of the form {"john" {1 {"alice" 1, "bob" 3}, 4 {"alice" 2, "stan" 1}, "alice" {1 {"john" 1, "mandy" 2}, 2 {"john" 3, "stan" 2}}} It shows for each user days on which he communicated, and for each day, with whom and how many times he addressed that person. Essentially this is a

a default value for get-in?

2010-05-17 Thread braver
If get-in is to be consistent with get, it better allow to specify a default value: (get-in nested-structure [k1 k2 ... kN] :default something) -- would it make sense to add that to the standard get-in? Cheers, Alexy -- You received this message because you are subscribed to the Google Groups

Re: longest contiguous increasing subsequence

2010-02-03 Thread braver
Meikel -- cool lazy solution, but doesn't generalize to replace <= with a predicate. Here's my non-lazy, reduce-based one generic with instantiations: (defn clis-pred [pred s] (let [[x & xs] s [r zs _] (reduce (fn [[r zs z] e] (if (pred z e) [r (conj zs e) e] [(conj r zs) [e] e]))

longest contiguous increasing subsequence

2010-01-28 Thread braver
I'd like to partition a positive numeric sequence into subsequences so that each increasing subsequence is the longest possible among its neighbors. Here's the closest I got so far: (use 'clojure.contrib.seq-utils) (defn clis [s] (->> s (into [-1]) (partition 2 1) (partition-by (fn [[x y]] (< x y