Re: Rolling back transactions with clojure.java.jdbc

2013-10-24 Thread Sean Corfield
Remove :transaction? true from the delete! call. You're telling delete! to run inside its own transaction - you don't want that: that's why your deletes do not rollback. Sean On Thu, Oct 24, 2013 at 2:03 PM, Mark wrote: > I've been working on a small utility script to clean up a very large tabl

Re: Clojure & Jruby (Ruby on Rails) Interop

2013-10-24 Thread rdelcueto
Thanks for your response Jim. Is there any alternative solution to Openshift that supports the TB and Immutant combo, that you recommend? On Thursday, October 24, 2013 8:47:14 PM UTC-5, Jim Crossley wrote: > > Unfortunately not, Rodrigo. Frankly, TorqueBox on OpenShift is not a very > happy expe

Re: Clojure & Jruby (Ruby on Rails) Interop

2013-10-24 Thread Jim Crossley
Unfortunately not, Rodrigo. Frankly, TorqueBox on OpenShift is not a very happy experience, mostly due to bundler and very limited resources on the free OpenShift gears. Until we get those issues worked out, I don't want to encourage anyone to combine TB and Immutant on OpenShift. Also, we're kind

Re: [ANN] Jig

2013-10-24 Thread Malcolm Sparks
Hi Tim, I've just pushed Jig 1.2.0 to https://github.com/juxt/jig. This release adds support for Ring and Compojure, which many people have asked for, including proper examples of using both Ring/Compojure and Pedestal services. There are numerous other components included (Git pull, JMX, ngin

Re: Clojure & Jruby (Ruby on Rails) Interop

2013-10-24 Thread rdelcueto
Dear Jim, I just began playing with Immutant and TorqueBox. I realized the polyglot-openshift-quickstart* @ *GitHub is marked as obsolete. I found links to newer versions of immutant-quickstart and torquebox-quickstart, though as separate applications. Is there documentation or a tutorial on how

Re: Request for help optimising a Clojure program

2013-10-24 Thread Evan Gamble
As Andy Fingerhut pointed out, since (hash [a b]) is 31*(a + 30) + (b + 31) when a and b are ints, summing the hashes of 2-tuples when the values are small ints, as happens when hashing sets of such 2-tuples, is quite likely to lead to collisions. This particular problem could be avoided by spr

Re: Need help with recursion!

2013-10-24 Thread Kelker Ryan
The code you pasted doesn't actually find the common divisor of two numbers.  user> (cds 100 200)[0 100] Here's my code using loop/recur (defn cds [x y]  (loop [i (->> (min x y) inc (range 1)) ret []]    (if-let [n (first i)]  (if-not (= 0 (rem x n) (rem y n))    (recur (rest i) ret

Rolling back transactions with clojure.java.jdbc

2013-10-24 Thread Mark
I've been working on a small utility script to clean up a very large table (~1 billion rows). Because the table is so large, I want to go through and delete it chunk at a time. I've written a simple script that does this, but when I was testing it against our dev instance, I found that it wasn't

Re: Counterclockwise Eclipse Plugin Documentation

2013-10-24 Thread Josh Kamau
Thank you Laurent. On Thu, Oct 24, 2013 at 8:12 PM, Laurent PETIT wrote: > Hello, > > For Counterclockwise, the Eclipse Plugin for Clojure, I've worked on > the documentation recently. > > tl;dr: > - The documentation is now at http://doc.ccw-ide.org . I hope you'll > find it prettier, easier to

Counterclockwise Eclipse Plugin Documentation

2013-10-24 Thread Laurent PETIT
Hello, For Counterclockwise, the Eclipse Plugin for Clojure, I've worked on the documentation recently. tl;dr: - The documentation is now at http://doc.ccw-ide.org . I hope you'll find it prettier, easier to link at. - Technically, it is now in the code's repo, in Asciidoc markup format. I hope i

Re: Need help with recursion!

2013-10-24 Thread Bartosz Kaliszuk
On Thu, Oct 24, 2013 at 5:32 PM, Kelker Ryan wrote: > Try this. > > (defn my-filter [pred? coll] > (loop [c coll > ret (empty c)] > (if-let [x (first c)] > (if (pred? x) > (recur (rest c) (lazy-cat ret [x])) > (recur (rest c) ret)) > ret))) > While we a

Re: Request for help optimising a Clojure program

2013-10-24 Thread David Nolen
OK, it appears defrecord suffers from a problem that used to plague Scala case classes as well - http://issues.scala-lang.org/browse/SI-2537. David On Thu, Oct 24, 2013 at 8:08 AM, Paul Butcher wrote: > On 23 Oct 2013, at 18:37, David Nolen wrote: > > The problem here is that you're not follow

clj(s) Countdown? (like the one there was on clojurecup.com)

2013-10-24 Thread Bastien
Hi all, I'd like to display a countdown like the one there was for the clojurecup.com website before the event. Did anyone implement this? Is the code behind clojurecup.com available somewhere? Thanks in advance! -- Bastien -- -- You received this message because you are subscribed to the

Re: Need help with recursion!

2013-10-24 Thread Kelker Ryan
Try this. (defn my-filter [pred? coll] (loop [c coll ret (empty c)] (if-let [x (first c)] (if (pred? x) (recur (rest c) (lazy-cat ret [x])) (recur (rest c) ret)) ret))) 24.10.2013, 23:58, "Wilson" : >  I am supposed to make my own filter function witho

Re: Need help with recursion!

2013-10-24 Thread Wilson
Thank you both for your help! That was so quick! Jeb's solution worked like a charm, and now I can finally advance to the next exercise. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.co

Re: Need help with recursion!

2013-10-24 Thread Bartosz Kaliszuk
Hi Wilson, As I'm learning clojure myself, I won't help you with code, but with algo:P 1. you are missing the pred? in my-filter call 2. you are missing the else clause for the if statemant handling situation when first element on the list does not meet the pred? criteria. I hope this helps. Rega

Prevent memory growth with lamina

2013-10-24 Thread Jake Pearson
Hi, Is there a mechanism in lamina to prevent unchecked growth of channel size? For example, is there a way to have enqueue block until the queue size is less than 10? thanks, Jake -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Re: Need help with recursion!

2013-10-24 Thread Jeb Beich
Tweaked slightly... (defn my-filter [pred? a-seq] (if (empty? a-seq) a-seq (if (pred? (first a-seq)) (cons (first a-seq) (my-filter pred? (rest a-seq))) (my-filter pred? (rest a-seq) On Thu, Oct 24, 2013 at 9:51 AM, Wilson wrote: > I am supposed to make my own filter

Need help with recursion!

2013-10-24 Thread Wilson
I am supposed to make my own filter function without using "remove". I have this made, but it is not working like it should be working. I don't have any idea what is wrong with it. Please help me out. For example, if I give the function the parameters odd? and [1 2 3 4]. It only returns (1), but

Re: Request for help optimising a Clojure program

2013-10-24 Thread Paul Butcher
On 23 Oct 2013, at 18:37, David Nolen wrote: > The problem here is that you're not following your Scala solution closely > enough. I suspect if you used defrecords to represent the pieces the way that > you used a class in Scala you can avoid the number of collisions for larger > problems. >

Re: Request for help optimising a Clojure program

2013-10-24 Thread Paul Butcher
On 24 Oct 2013, at 11:34, Phillip Lord wrote: > What does Scala do? I mean, given that it doesn't have the same problem, > perhaps it has a solution? By default, Scala uses a tree-based set, not a hash-based set. So the fact that it doesn't run into hashing issues isn't surprising (and is yet a

Re: Request for help optimising a Clojure program

2013-10-24 Thread Phillip Lord
What does Scala do? I mean, given that it doesn't have the same problem, perhaps it has a solution? Andy Fingerhut writes: > If you can think of a different hash function for vectors that doesn't lead > to these types of collisions, I'm all ears. The issue is that the hash > function for sets

Re: Request for help optimising a Clojure program

2013-10-24 Thread Paul Butcher
On 24 Oct 2013, at 01:46, Stuart Halloway wrote: > Is the Scala for lazy or eager? If the latter, you are not comparing apples > to apples (separate from the other differences David already pointed out.) Oh, it's eager. Bear in mind that my purpose wasn't really to directly compare Scala and