Re: Request for help optimising a Clojure program
BTW, in the sample set hashing function I provided, the `reduce +` should have been `reduce unchecked-add-int` I've done some timing tests (on a loop/recur version that leverages primitive math better) and it looks like the strategy I proposed has a negligible impact on the current hashing strategy, with the benefits of better hash distribution. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Request for help optimising a Clojure program
Ugh, I meant negligible impact on the running time versus the current hashing strategy On Wed, Oct 23, 2013 at 11:48 PM, Mark Engelberg mark.engelb...@gmail.comwrote: BTW, in the sample set hashing function I provided, the `reduce +` should have been `reduce unchecked-add-int` I've done some timing tests (on a loop/recur version that leverages primitive math better) and it looks like the strategy I proposed has a negligible impact on the current hashing strategy, with the benefits of better hash distribution. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Request for help optimising a Clojure program
On 24 Oct 2013, at 01:46, Stuart Halloway stuart.hallo...@gmail.com 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 Clojure - in fact, I was originally planning to knock up a fully lazy solution in Clojure to demonstrate that the memory-hungry eager Scala solution could be trivially made to run in much less memory in Clojure. Unfortunately I got mired in this performance issue before I could get to that point. -- paul.butcher-msgCount++ Snetterton, Castle Combe, Cadwell Park... Who says I have a one track mind? http://www.paulbutcher.com/ LinkedIn: http://www.linkedin.com/in/paulbutcher MSN: p...@paulbutcher.com AIM: paulrabutcher Skype: paulrabutcher -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Request for help optimising a Clojure program
On 24 Oct 2013, at 11:34, Phillip Lord phillip.l...@newcastle.ac.uk 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 another example of how this isn't a perfect apples-to-apples comparison). However, I've just tried rerunning the Scala using a hash-based set implementation, and that takes the runtime down from around 2.5 minutes to just over 2. -- paul.butcher-msgCount++ Snetterton, Castle Combe, Cadwell Park... Who says I have a one track mind? http://www.paulbutcher.com/ LinkedIn: http://www.linkedin.com/in/paulbutcher MSN: p...@paulbutcher.com AIM: paulrabutcher Skype: paulrabutcher -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Request for help optimising a Clojure program
On 23 Oct 2013, at 18:37, David Nolen dnolen.li...@gmail.com 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. Not tested much but I tried something like the following and I no longer see hash collisions dominating in YourKit: It would be lovely if it was that easy, David. However, I still see lots of hash collisions when using records. Here's a portion of the output from an implementation that's instrumented to print hash codes, similar to what Andy did with the vector-based implementation: 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 2]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :N, :pos [0 1]} #chess_clojure.core.Piece{:name :R, :pos [8 4]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 4]} #chess_clojure.core.Piece{:name :Q, :pos [3 3]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :R, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 4]} #chess_clojure.core.Piece{:name :Q, :pos [3 3]} #chess_clojure.core.Piece{:name :B, :pos [1 4]} #chess_clojure.core.Piece{:name :R, :pos [8 1]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :R, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 5]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :R, :pos [8 4]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :N, :pos [8 0]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :N, :pos [8 0]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 2]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :R, :pos [0 0]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 5]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 2]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 5]} #chess_clojure.core.Piece{:name :N, :pos [8 2]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 5]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :N, :pos [8 2]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :R, :pos [0 2]} #chess_clojure.core.Piece{:name :N, :pos [8 1]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 5]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :R, :pos [1 2]} #chess_clojure.core.Piece{:name :N, :pos [8 1]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :R, :pos [7 2]} #chess_clojure.core.Piece{:name :N, :pos [0 0]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :R, :pos [1 0]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 0]} #chess_clojure.core.Piece{:name :R, :pos [0 2]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :B, :pos [1 4]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :R, :pos [0 0]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :B, :pos [1 4]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :B, :pos [0 3]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [1 4]} #chess_clojure.core.Piece{:name :Q, :pos [3 3]}
Need help with recursion!
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 it should obviously return (1 3). I don't know why it works like that. (defn my-filter [pred? a-seq] (if (empty? a-seq) a-seq (if (pred? (first a-seq)) (cons (first a-seq) (my-filter (rest a-seq) '()) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Need help with recursion!
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 tortugac...@gmail.com wrote: 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 it should obviously return (1 3). I don't know why it works like that. (defn my-filter [pred? a-seq] (if (empty? a-seq) a-seq (if (pred? (first a-seq)) (cons (first a-seq) (my-filter (rest a-seq) '()) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Prevent memory growth with lamina
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 this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Need help with recursion!
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. Regards, Bartosz p.s. first post!;-) On Thu, Oct 24, 2013 at 4:51 PM, Wilson tortugac...@gmail.com wrote: 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 it should obviously return (1 3). I don't know why it works like that. (defn my-filter [pred? a-seq] (if (empty? a-seq) a-seq (if (pred? (first a-seq)) (cons (first a-seq) (my-filter (rest a-seq) '()) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- Regards Bartosz Kaliszuk bartosz(dot)kaliszuk(at)gmail(dot)com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Need help with recursion!
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.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Need help with recursion!
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 tortugac...@gmail.com: 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 it should obviously return (1 3). I don't know why it works like that. (defn my-filter [pred? a-seq] (if (empty? a-seq) a-seq (if (pred? (first a-seq)) (cons (first a-seq) (my-filter (rest a-seq) '()) -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Request for help optimising a Clojure program
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 p...@paulbutcher.com wrote: On 23 Oct 2013, at 18:37, David Nolen dnolen.li...@gmail.com 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. Not tested much but I tried something like the following and I no longer see hash collisions dominating in YourKit: It would be lovely if it was that easy, David. However, I still see lots of hash collisions when using records. Here's a portion of the output from an implementation that's instrumented to print hash codes, similar to what Andy did with the vector-based implementation: 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 2]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :N, :pos [0 1]} #chess_clojure.core.Piece{:name :R, :pos [8 4]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 4]} #chess_clojure.core.Piece{:name :Q, :pos [3 3]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :R, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 4]} #chess_clojure.core.Piece{:name :Q, :pos [3 3]} #chess_clojure.core.Piece{:name :B, :pos [1 4]} #chess_clojure.core.Piece{:name :R, :pos [8 1]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :R, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :N, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 5]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :R, :pos [8 4]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :N, :pos [8 0]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :N, :pos [8 0]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 2]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :R, :pos [0 0]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 5]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 2]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :R, :pos [0 3]} #chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 0]} #chess_clojure.core.Piece{:name :N, :pos [8 5]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 5]} #chess_clojure.core.Piece{:name :N, :pos [8 2]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 5]} #chess_clojure.core.Piece{:name :R, :pos [1 1]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :N, :pos [8 2]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :R, :pos [0 2]} #chess_clojure.core.Piece{:name :N, :pos [8 1]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 5]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :R, :pos [1 2]} #chess_clojure.core.Piece{:name :N, :pos [8 1]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [3 4]} #chess_clojure.core.Piece{:name :B, :pos [1 5]} #chess_clojure.core.Piece{:name :R, :pos [7 2]} #chess_clojure.core.Piece{:name :N, :pos [0 0]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :B, :pos [0 4]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :R, :pos [1 0]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 0]} #chess_clojure.core.Piece{:name :R, :pos [0 2]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :B, :pos [1 4]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]} #chess_clojure.core.Piece{:name :R, :pos [0 0]} #chess_clojure.core.Piece{:name :N, :pos [6 5]} #chess_clojure.core.Piece{:name :B, :pos [1 4]}} 842565000: #{#chess_clojure.core.Piece{:name :Q, :pos [4 2]}
Re: Need help with recursion!
On Thu, Oct 24, 2013 at 5:32 PM, Kelker Ryan theinter...@yandex.com 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 are on loop/recur and if-let: How would if-let version of my function common divisors look like? Would I benefit from it in any way? (defn cds [x y] (loop [a x b y result []] (if (= 0 (rem a b)) (conj result b) (recur b (rem a b) (conj result (int (/ a b))) -- Regards Bartosz Kaliszuk bartosz(dot)kaliszuk(at)gmail(dot)com -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Counterclockwise Eclipse Plugin Documentation
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 it will make it easier for people to contribute to it. Full story: - I switched the main documentation from Google Code's Wiki to the doc/ folder in Counterclockwise Github's repository : https://github.com/laurentpetit/ccw/tree/master/doc/src - The documentation format uses Asciidoc ( http://asciidoctor.org/ ) and is integrated in the maven build. - Now the documentation is per branch, and is rebuilt thanks to Travis-CI ( https://travis-ci.org/laurentpetit/ccw/builds ) for each branch and each push on Github. - Each travis-build/branch Travis build is stored along the product artifacts, e.g. http://updatesite.ccw-ide.org/branch/master/master-travis000169-git496b970a9f74d7b25efe4ada6d7903cb0a434ea6/doc/ for Travis's build 169 of commit 496b9 on branch master. - As a convenience, there's a permanent location for each branch's tip documentation, e.g. http://updatesite.ccw-ide.org/branch/master/doc/ for branch master - Last but not least, the documentation for the current version is available easy at http://doc.ccw-ide.org/ Cheers, -- Laurent Petit -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Counterclockwise Eclipse Plugin Documentation
Thank you Laurent. On Thu, Oct 24, 2013 at 8:12 PM, Laurent PETIT laurent.pe...@gmail.comwrote: 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 it will make it easier for people to contribute to it. Full story: - I switched the main documentation from Google Code's Wiki to the doc/ folder in Counterclockwise Github's repository : https://github.com/laurentpetit/ccw/tree/master/doc/src - The documentation format uses Asciidoc ( http://asciidoctor.org/ ) and is integrated in the maven build. - Now the documentation is per branch, and is rebuilt thanks to Travis-CI ( https://travis-ci.org/laurentpetit/ccw/builds ) for each branch and each push on Github. - Each travis-build/branch Travis build is stored along the product artifacts, e.g. http://updatesite.ccw-ide.org/branch/master/master-travis000169-git496b970a9f74d7b25efe4ada6d7903cb0a434ea6/doc/ for Travis's build 169 of commit 496b9 on branch master. - As a convenience, there's a permanent location for each branch's tip documentation, e.g. http://updatesite.ccw-ide.org/branch/master/doc/ for branch master - Last but not least, the documentation for the current version is available easy at http://doc.ccw-ide.org/ Cheers, -- Laurent Petit -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Rolling back transactions with clojure.java.jdbc
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 rolling back, as I'd hoped it would. You can see a simplified version of the script here: https://gist.github.com/anonymous/14ed57085709a2772ee0 It's using an Oracle database (11GR1, I think) and clojure.java.jdbc version 0.3.0-alpha5. I've dug through the clojure.java.jdbc docs and code, but I don't see an obvious problem with what I'm doing, although I presume that to someone who knows this library better, my problem is quite simple. Does anyone have any idea what I'm doing wrong? Can you point to an example that issues deletes (or inserts, or updates) that rollback? Thanks! Mark -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Need help with recursion!
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) (recur (rest i) (conj ret n))) ret))) Here's the output user (cds 100 200)[1 2 4 5 10 20 25 50 100] You can check with WolframAlpha = https://www.wolframalpha.com/input/?i=common%20divisors%20of%20100%20200 25.10.2013, 01:18, "Bartosz Kaliszuk" bartosz.kalis...@gmail.com:On Thu, Oct 24, 2013 at 5:32 PM, Kelker Ryan theinter...@yandex.com 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 are on loop/recur and if-let: How would if-let version of my function common divisors look like? Would I benefit from it in any way?(defn cds [x y] (loop [a x b y result []] (if (= 0 (rem a b)) (conj result b) (recur b (rem a b) (conj result (int (/ a b)))-- Regards Bartosz Kaliszuk bartosz(dot)kaliszuk(at)gmail(dot)com -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Request for help optimising a Clojure program
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 spreading the hashes of ints out to large numbers with a non-linear function, not just multiplying them all by some N. On Wednesday, October 23, 2013 5:41:15 PM UTC-7, puzzler wrote: Perhaps I don't understand your point, but vector hashing is not currently the sum of hashes. It's a more complex computation. = (hash [0 2]) 963 = (hash [2 0]) 1023 = (hash [2]) 33 The fact that numbers hash to themselves means that the resulting hashes are not hugely spread apart, but collisions don't seem to be as common as with sets and maps. I'm sure it could be improved, but vector/sequence hashing doesn't strike me as a huge issue. On Wed, Oct 23, 2013 at 5:31 PM, Cedric Greevey cgre...@gmail.comjavascript: wrote: There's still a problem with collisions among *vectors* though. I'd say the real underlying problem is that small integers hash to themselves. If you let N be a fairly large number satisfying GCD(N, 2^32 - 1) = 1, then multiplying 32-bit integers by N would send nearby integers to widely separated ones, while inducing a permutation on nonzero integers -- the hash space wouldn't be any smaller. That alone won't help much with the vector problem, since 3N + 2N = 5N just as 3 + 2 = 5, though it may help avoid collisions with small integers in small hash maps when the hash is being used modulo a small hash-table length. What might help with vectors, sets, and other small data structures containing integers (but would shrink the hash space by about half) is to additionally square the result (all operations being 2s-complement 32-bit integer operations with wrapping -- Java int arithmetic). Now 1 and 4 won't give the same summed hashes as 3 and 2, and 0 and 5 will be different again. You might also want to add some constant to avoid 0 hashing to 0. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure Jruby (Ruby on Rails) Interop
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 to get TorqueBox and Immutant merged into a single OpenShift application, ala lein immutant overlay torquebox? Regards, On Monday, September 9, 2013 11:14:54 AM UTC-5, Jim Crossley wrote: Hi Rodrigo, I'm one of the developers of TorqueBox and Immutant. Your email prompted me to re-watch a screencast [1] I made in March showing how to use them together. I realized things have changed a little since then, so I added a few annotations to the video highlighting the differences. Hopefully enough to get you up and experimenting. As you've probably figured out, both TorqueBox and Immutant are integrated stacks, bundling some commodity services that most non-trivial applications need, e.g. scheduling, caching, and messaging. The intent of any integrated platform is to relieve administration burden. But that only works for you if the inherent choices within that stack fit the needs of your app. We think/hope default Immutant configuration and abstractions (e.g. queues, topics, request/respond) offers a good balance to fit a wide variety of apps. If simple integration between Ruby and Clojure apps is your chief goal, I think Immutant/TorqueBox is compelling, but I'm biased. I would definitely recommend using some sort of messaging broker, though, i.e. don't mix Clojure and Ruby in the same source file or project. Performance and security concerns are so application-specific I hate to make any generic statements about them other than, be fast and secure. ;-) But do feel free to bother us in #torquebox or #immutant on freenode with any questions about your particular app/needs. Thanks, Jim [1] http://immutant.org/news/2013/03/07/overlay-screencast/ On Sun, Sep 8, 2013 at 10:25 PM, rdelcueto rdel...@gmail.comjavascript: wrote: Hi everyone, I'm about to start working on building a site for a startup company. We are a small team, and currently they've been coding the site using RoR (Ruby on Rails). I was thinking Clojure might be better suited for the task, specially because we'll need to implement a backend which is robust, scalable and secure, but also we'll need flexibility, which I think the RoR framework won't shine at all. At our team, we are two coders, non of us are proficient in Web Developing, and we have little experience with RoR, and I thought (I'm sure) maybe investing time learning Clojure will provide us with better tools. PROBLEM/QUESTION While searching for alternative solutions, I stumbled upon the Flightcaster case, we're they are using RoR to implement the site's frontend and Clojure for the system backend. I thought this was a very elegant solution, using each tool for what it's good at. Plus this way we can reuse what they've already implemented. I found a way to do this is by using Torquebox and Immutant, and using the messaging systems to communicate between Jruby and Clojure. Still I have no idea of how this works, and the performance and security implications it brings to the table. I found little information on the subject. I would appreciate if anyone could provide guidance, examples or documentation on the subject. Any reference to open source projects which use this hybrid language solutions on the JVM would be great to have. Is this the best way to solve the RoR interactions? Is there any other way? Thanks in advance and best regards, Rodrigo -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To
Re: [ANN] Jig
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, nginx) to support an automated continuous deployment process. As you pointed out, there were missing details in my own work branches, so the packaged examples should hopefully make things clearer. Thanks for the feedback on using Jig, it is much appreciated, and please let me know if you still need some help with the specifics. Regards, Malcolm On Monday, 21 October 2013 21:14:32 UTC+1, frye wrote: Hey Malcolm, So since you guys just have Pedestal set up at the moment, I've started there. *My Repos * You can see my project jig herehttps://github.com/stefonweblog/stefon-jig/blob/master/config/config.clj. It connects to commonhttps://github.com/stefonweblog/stefon-webui-common/blob/master/src/stefon_webui_common/core.clj , compojurehttps://github.com/stefonweblog/stefon-compojure/blob/master/src/stefon_compojure/core.clj (not yet configured), and pedestal-servicehttps://github.com/stefonweblog/stefon-pedestal-service/blob/master/src/stefon_pedestal_service/service.clj component. I'm trying to get the Pedestal portions working. Now, I haven't yet been able to stitch together routes using the Pedestal :juxtweb/service component you have. The :server component runs fine, when executing (go). But the handlers don't seem to be attached. Do I need a separate :jig/projects entry in my config? { :jig/components { ;; === :server {:jig/component jig.web.server/Component :io.pedestal.service.http/port 8000 :io.pedestal.service.http/type :jetty} :juxtweb/web {:jig/component jig.web.app/Component :jig/dependencies [:server] :jig/scheme :http :jig/hostname localhost :jig.web/server :server} ;; === :stefon-webui-common {:jig/component stefon-webui-common.core/Component :jig/project ../stefon-webui-common/project.clj} :stefon-compojure {:jig/component stefon-compojure.core/Component :jig/project ../stefon-compojure/project.clj :jig/dependencies [:server :stefon-webui-common]} :stefon-pedestal {:jig/component stefon-pedestal-service.service/Component :jig/project ../stefon-pedestal-service/project.clj :jig/dependencies [:juxtweb/web :stefon-webui-common] :jig.web/app-name :juxtweb/web} }} *Juxt's Cloned Repos * So I tried cloning your example repos to see working example code. But there's a few things that went awry. *A)* I had to rename the cloned repo for the referencing in jig/config/config.clj to work (:jig/project ../accounting/project.clj). ~/Projects/trial/*JIG*$ ls -la accounting/ *;; had to `mv juxt-accounting accounting` * jig/ juxtweb/ *B)* Also, you've hard-coded an accounts db file to your hard drive *java.io.FileNotFoundException: /home/malcolm/Dropbox.private/JUXT/accounts.edn* Tim Washington Interruptsoftware.ca / Bkeeping.com On Mon, Oct 21, 2013 at 3:57 AM, Malcolm Sparks mal...@juxt.projavascript: wrote: Hi Tim, Good to hear you're finding Jig useful. There isn't any explicit support for Ring in Jig yet, it's just Pedestal services right now. The separation of jig.web.server and jig.web.app into 2 components is to allow multiple 'virtual hosts' to share the same Jetty server, if necessary. It's a third component, usually your own, that actually adds routes to a virtual host. See the ReadmeComponent in examples/docsite/src/examples/docsite/core.clj herehttps://github.com/juxt/jig/blob/master/examples/docsite/src/examples/docsite/core.clj#L75. It adds routes in its init phase. The idea is that other components can be contribute routes in the same way, so you have the option of breaking up a website into modules. The nice thing about Pedestal services is that hyperlinks can be generated using the url-for functionality it provides. If you use this feature consistently, you can treat the jig.web.app as an anchor on which to hook multiple applications and configure the URL tree accordingly. I'm intrigued by this url-for feature and wanted to experiment with it with Jig. Since Compojure doesn't have this automatic ability to create links from handler vars, it's likely you'll want to set it up manually. Here's a suggestion for how to do this: 1. Create a Ring server component. 2. In the init phase, add an empty vector called :routes. Other components can depend on this one,
Re: Clojure Jruby (Ruby on Rails) Interop
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 kinda in a wait-and-see mode while the OpenShift guys integrate Docker, as container images should be a lot easier to work with than cartridges. So you're ahead of us at the moment. We expect to catch up, just not sure when. Jim On Thu, Oct 24, 2013 at 8:45 PM, rdelcueto rdelcu...@gmail.com wrote: 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 to get TorqueBox and Immutant merged into a single OpenShift application, ala lein immutant overlay torquebox? Regards, On Monday, September 9, 2013 11:14:54 AM UTC-5, Jim Crossley wrote: Hi Rodrigo, I'm one of the developers of TorqueBox and Immutant. Your email prompted me to re-watch a screencast [1] I made in March showing how to use them together. I realized things have changed a little since then, so I added a few annotations to the video highlighting the differences. Hopefully enough to get you up and experimenting. As you've probably figured out, both TorqueBox and Immutant are integrated stacks, bundling some commodity services that most non-trivial applications need, e.g. scheduling, caching, and messaging. The intent of any integrated platform is to relieve administration burden. But that only works for you if the inherent choices within that stack fit the needs of your app. We think/hope default Immutant configuration and abstractions (e.g. queues, topics, request/respond) offers a good balance to fit a wide variety of apps. If simple integration between Ruby and Clojure apps is your chief goal, I think Immutant/TorqueBox is compelling, but I'm biased. I would definitely recommend using some sort of messaging broker, though, i.e. don't mix Clojure and Ruby in the same source file or project. Performance and security concerns are so application-specific I hate to make any generic statements about them other than, be fast and secure. ;-) But do feel free to bother us in #torquebox or #immutant on freenode with any questions about your particular app/needs. Thanks, Jim [1] http://immutant.org/news/**2013/03/07/overlay-screencast/http://immutant.org/news/2013/03/07/overlay-screencast/ On Sun, Sep 8, 2013 at 10:25 PM, rdelcueto rdel...@gmail.com wrote: Hi everyone, I'm about to start working on building a site for a startup company. We are a small team, and currently they've been coding the site using RoR (Ruby on Rails). I was thinking Clojure might be better suited for the task, specially because we'll need to implement a backend which is robust, scalable and secure, but also we'll need flexibility, which I think the RoR framework won't shine at all. At our team, we are two coders, non of us are proficient in Web Developing, and we have little experience with RoR, and I thought (I'm sure) maybe investing time learning Clojure will provide us with better tools. PROBLEM/QUESTION While searching for alternative solutions, I stumbled upon the Flightcaster case, we're they are using RoR to implement the site's frontend and Clojure for the system backend. I thought this was a very elegant solution, using each tool for what it's good at. Plus this way we can reuse what they've already implemented. I found a way to do this is by using Torquebox and Immutant, and using the messaging systems to communicate between Jruby and Clojure. Still I have no idea of how this works, and the performance and security implications it brings to the table. I found little information on the subject. I would appreciate if anyone could provide guidance, examples or documentation on the subject. Any reference to open source projects which use this hybrid language solutions on the JVM would be great to have. Is this the best way to solve the RoR interactions? Is there any other way? Thanks in advance and best regards, Rodrigo -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@**googlegroups.com For more options, visit this group at http://groups.google.com/**group/clojure?hl=enhttp://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an
Re: Clojure Jruby (Ruby on Rails) Interop
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 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 kinda in a wait-and-see mode while the OpenShift guys integrate Docker, as container images should be a lot easier to work with than cartridges. So you're ahead of us at the moment. We expect to catch up, just not sure when. Jim On Thu, Oct 24, 2013 at 8:45 PM, rdelcueto rdel...@gmail.comjavascript: wrote: 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 to get TorqueBox and Immutant merged into a single OpenShift application, ala lein immutant overlay torquebox? Regards, On Monday, September 9, 2013 11:14:54 AM UTC-5, Jim Crossley wrote: Hi Rodrigo, I'm one of the developers of TorqueBox and Immutant. Your email prompted me to re-watch a screencast [1] I made in March showing how to use them together. I realized things have changed a little since then, so I added a few annotations to the video highlighting the differences. Hopefully enough to get you up and experimenting. As you've probably figured out, both TorqueBox and Immutant are integrated stacks, bundling some commodity services that most non-trivial applications need, e.g. scheduling, caching, and messaging. The intent of any integrated platform is to relieve administration burden. But that only works for you if the inherent choices within that stack fit the needs of your app. We think/hope default Immutant configuration and abstractions (e.g. queues, topics, request/respond) offers a good balance to fit a wide variety of apps. If simple integration between Ruby and Clojure apps is your chief goal, I think Immutant/TorqueBox is compelling, but I'm biased. I would definitely recommend using some sort of messaging broker, though, i.e. don't mix Clojure and Ruby in the same source file or project. Performance and security concerns are so application-specific I hate to make any generic statements about them other than, be fast and secure. ;-) But do feel free to bother us in #torquebox or #immutant on freenode with any questions about your particular app/needs. Thanks, Jim [1] http://immutant.org/news/**2013/03/07/overlay-screencast/http://immutant.org/news/2013/03/07/overlay-screencast/ On Sun, Sep 8, 2013 at 10:25 PM, rdelcueto rdel...@gmail.com wrote: Hi everyone, I'm about to start working on building a site for a startup company. We are a small team, and currently they've been coding the site using RoR (Ruby on Rails). I was thinking Clojure might be better suited for the task, specially because we'll need to implement a backend which is robust, scalable and secure, but also we'll need flexibility, which I think the RoR framework won't shine at all. At our team, we are two coders, non of us are proficient in Web Developing, and we have little experience with RoR, and I thought (I'm sure) maybe investing time learning Clojure will provide us with better tools. PROBLEM/QUESTION While searching for alternative solutions, I stumbled upon the Flightcaster case, we're they are using RoR to implement the site's frontend and Clojure for the system backend. I thought this was a very elegant solution, using each tool for what it's good at. Plus this way we can reuse what they've already implemented. I found a way to do this is by using Torquebox and Immutant, and using the messaging systems to communicate between Jruby and Clojure. Still I have no idea of how this works, and the performance and security implications it brings to the table. I found little information on the subject. I would appreciate if anyone could provide guidance, examples or documentation on the subject. Any reference to open source projects which use this hybrid language solutions on the JVM would be great to have. Is this the best way to solve the RoR interactions? Is there any other way? Thanks in advance and best regards, Rodrigo -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@**googlegroups.com For more options, visit