Re: Relational mapping - turning an sql query result into array of hashes (with joins)

2015-05-25 Thread Sam Roberton
On Tuesday, 26 May 2015 06:43:18 UTC+10, Krzysiek Herod wrote: > > Sean, maybe my use case is specific to web applications. In REST API's > it's common to respond with something like "Example Result" here: > https://dev.twitter.com/rest/reference/get/statuses/mentions_timeline I > completely agr

Re: Help with timestamp with timezone in YeSQL

2015-05-16 Thread Sam Roberton
On Sunday, 17 May 2015 01:46:14 UTC+10, g vim wrote: > > > > (c/to-timestamp "1967-07-31 06:30:00 America/Caracas") > > evaluates to nil. However: > > (c/to-timestamp "1967-07-31 06:30:00") > > gives me an: #inst "1967-07-31T06:30:00.0-00:00" , > whatever that is, so I che

Re: code-rewriting "with-connection" macro (monger and maybe beyond?)

2015-04-12 Thread Sam Roberton
I use partial for a sort-of-similar scenario. It gets you a reasonable way there without adding any real complexity. (defn do-stuff [db coll m] (let [update (partial update db coll) insert (partial insert db coll)] (insert m) (update m) ...)) You could wrap it with a macro

Re: Enhanced Primitive Support Syntax

2011-01-16 Thread Sam Roberton
On 16 January 2011 05:35, Jason Wolfe wrote: >> (a) unsafe/incorrect value on overflow/fastest/unifiable* vs. >> (b) safe/error on overflow/fast/unifiable vs. >> (c) safe/promoting on overflow/slow/not-unifiable > > If I understand correctly, the issue with auto-promotion is that we > have to box

Re: error with doseq in defrecord function

2010-10-31 Thread Sam Roberton
> (defrecord Foo [properties] >   Fooable >   (foo [f] >     (let [s (java.util.HashSet.)] >      (doto s >    (doseq [p properties] (.add s p)) > > When I load/reload the above code in the repl I get this error > > vector for its binding (config.clj:22)> The problem is the way you're cal

Re: strange bug in range or lazy-seq?

2010-10-11 Thread Sam Roberton
> (def nums (cons 2 (lazy-seq (map inc nums > (def primes (cons (first nums) >              (lazy-seq (->> >                (rest nums) >                (remove >                  (fn [x] >                    (let [dividors (take-while #(<= (* % %) x) > primes)] >                      (some #(=