Re: Current state of the art in Web deployment?

2013-08-17 Thread Mark Mandel
On Sun, Aug 18, 2013 at 6:52 AM, John Jacobsen wrote: > After some prototyping and development, we are now getting to the stage > where "lein run" and a Jetty server running from -main aren't going to cut > it. At the risk of asking a dumb question, but being quite new to Clojure, I don't mind -

Re: Model validation - exceptions as side-effects?

2013-08-17 Thread Alexandr Kurilin
Leonardo, that's an interesting solution, thanks for writing it out and giving me some food for thought. My thought process was that at this point I have a pure API that either gets the right inputs or it simply does nothing. As in, no helping messages about what went wrong, no attempt to do re

Re: core.async - handling nils

2013-08-17 Thread Ben Wolfson
A sentinel value also prevents channels from being able to send/receive arbitrary values, without further wrapping. Sent from my iPhone On Aug 17, 2013, at 5:48 PM, Mikera wrote: > My overall sense is that the convenience of using if-let directly in a few > use cases doesn't justify making ch

Re: core.async - handling nils

2013-08-17 Thread Brandon Bloom
That's precisely the design followed by Magpie, described here: http://journal.stuffwithstuff.com/2013/04/17/well-done/ Parts 1 & 2 of that series are worth reading too. On Sat, Aug 17, 2013 at 8:48 PM, Mikera wrote: > My overall sense is that the convenience of using if-let directly in a few >

Re: What's your preference, partial or closures?

2013-08-17 Thread Sean Corfield
On Sat, Aug 17, 2013 at 5:43 PM, yair wrote: > What do you mean by currying in this context? Is there a way to do this in > clojure apart from using partial? (defn some-func ([a b c] (process a b c)) ([a b] (fn [c] (some-func a b c))) ([a] (fn ([b] (fn [c] (some-func a b c)))

Re: core.async - handling nils

2013-08-17 Thread Mikera
My overall sense is that the convenience of using if-let directly in a few use cases doesn't justify making channels fall short of being able to send arbitrary values (nil specifically, and clearly boolean false can cause some problems too). I think it would be a much better design to have a s

Re: What's your preference, partial or closures?

2013-08-17 Thread yair
What do you mean by currying in this context? Is there a way to do this in clojure apart from using partial? On Saturday, August 17, 2013 10:04:23 AM UTC+10, Sean Corfield wrote: > > I went down the partial path for a long time but have moved more and > more toward currying and closures lately

Re: ANN swag a DSL for documenting Compojure routes using Swagger

2013-08-17 Thread ronen
Cool, let me know how it works out for you On Saturday, August 17, 2013 5:01:46 AM UTC+3, Casper Clausen wrote: > > Nice work. Looking forward to giving it a spin. > > On Thursday, August 15, 2013 12:13:11 PM UTC+2, ronen wrote: >> >> Swagger is a cool

Re: Current state of the art in Web deployment?

2013-08-17 Thread Ray Miller
On 17 August 2013 21:52, John Jacobsen wrote: > > So, what do all y'all do? What is a good lightweight but robust way to get > a fairly simple Compojure/Ring app backed by Datomic facing the outside > world? Not too worried about massive scalability at this point; simplicity > will be a plus (am

Re: Do you like the Clojure syntax?

2013-08-17 Thread Tj Gabbour
Hi, Random thought from a very tired person. :) Programmers manipulate tiny pieces of reality, so tiny that quantum effects come into play. [1] Many of us (unknowingly) train our visual senses to help us calculate these strange manipulations with less strain. Maybe if we train it on too narrow

Current state of the art in Web deployment?

2013-08-17 Thread John Jacobsen
Hi folks, I'm starting work on a Clojure Web app and would like to get a sense for the current "standard" (if any) for deploying to production. In my case, I have an AWS Ubuntu instance, set up via Vagrant and Puppet, which mirrors some developer VMs. Datomic, leiningen etc. are running every

Re: function creation, partial or #()

2013-08-17 Thread Sean Corfield
Gosh darn... yes, that is what I want. That must be the only combination of things I didn't try! Thank you. On Sat, Aug 17, 2013 at 4:18 AM, Jay Fields wrote: > Sean, it sounds like you want > > (swap! some-a update-in [:k1 :k2] (fnil conj []) id) > > But that's based on some pretty limited conte

Re: logback.xml being picked up twice in project (how do I surpess the inheritted projects logback.xml)?

2013-08-17 Thread Stephen Cagle
Thanks Laurent, I did as you suggest and things seem to be fine now. I ended up using :profiles => :dev => :source-paths in my project.clj to include the 'dev-resources' directory. Seems to be in use when I lein repl, but is not included when I build a jar. Probably there are other problems wi

Re: vec to map with consolidated vals

2013-08-17 Thread Steven Degutis
Yeah, I totally agree that using core fns instead of anonymous fns makes code way more readable and easier to mentally scan. The main reason I suggested the anonymous function was for performance, which is probably premature-optimization at this point. But I think I agree with you and Jay, that sho

Re: Gensym collisions can be engineered.

2013-08-17 Thread J.-F. Rompre
Interesting discussion - I was pretty surprised to see this can happen I don't understand all the details about the solutions discussed in this thread, but it seems that the only way to ensure no local can be clobbered, gensym'ed or not, is to introduce into the RT a "local resolution phase"

Re: [ANN] Leiningen 2.3.1 released

2013-08-17 Thread James Qiu
After upgrade to 2.3.1, I can't find "repl-port" file in target directory, so "lein repl" will use a random port, I have to use "LEIN_REPL_PORT=33021 lein repl" to assign the port. 2013/8/14 Sean Corfield > Thank you! > > I've upgraded our team to 2.3.1, as well as our QA system. So far, no > p

Re: Generating a "Java bean" via Clojure?

2013-08-17 Thread Ryan Brush
Some Java frameworks will accept public final fields as Java bean fields. In that case, a Clojure record can be used directly (although I'm not sure if we're making an assumption about Clojure records that might change). This has actually worked for my limited needs in this space. The only othe

Re: Help to start creating this DSL in Clojure

2013-08-17 Thread Michael Klishin
Hussein B.: > Hi, > > I'm trying to create this Domain Specific Language: > > (query "clojure" > (directory "/usr/texts") > (group-by :creation-date)) > > > > Any starting points are really appreciated. > > Take a look at http://clojure-doc.org/articles/tutorials/growing_a_dsl

Help to start creating this DSL in Clojure

2013-08-17 Thread Hussein B.
Hi, I'm trying to create this Domain Specific Language: (query "clojure" (directory "/usr/texts") (group-by :creation-date)) What it should do is to search for all files in a specific directory using a regexp and then group the result by some of files attributes. The idea is t

Fwd: Hands-on Clojure: Collaborative Filtering

2013-08-17 Thread Ray Miller
if any of you are in Cambridge (UK) next Thursday evening, you're be welcome to join us at the next Camclj Meetup. Details below. -- Forwarded message -- From: Ray Miller Date: 17 August 2013 15:47 Subject: Hands-on Clojure: Collaborative Filtering To: cam...@googlegroups.com Ou

Re: function creation, partial or #()

2013-08-17 Thread Jay Fields
Sean, it sounds like you want (swap! some-a update-in [:k1 :k2] (fnil conj []) id) But that's based on some pretty limited context. On Friday, August 16, 2013, Sean Corfield wrote: > On Fri, Aug 16, 2013 at 4:32 PM, Timothy Baldridge > > > wrote: > > I'm just going to throw this out there, but

Re: function creation, partial or #()

2013-08-17 Thread Jay Fields
Thanks everyone. Seems like there's pretty solid agreement on which solution is preferred. Cheers, Jay On Saturday, August 17, 2013, David Chelimsky wrote: > On Fri, Aug 16, 2013 at 9:49 PM, Gregg Reynolds > > > wrote: > >> On Tue, Aug 13, 2013 at 1:50 PM, John D. Hume >> > 'duelin.mark...@gm

Re: vec to map with consolidated vals

2013-08-17 Thread Jay Fields
Of your proposed solutions, this one (defn to-consolidated-map [parts] (->> parts (map (partial apply hash-map)) (apply merge-with +)) Is the one I thought of first and also find very readable. On Saturday, August 17, 2013, David Chelimsky wrote: > Sorry - pressed send before refreshing an

Re: vec to map with consolidated vals

2013-08-17 Thread David Chelimsky
Sorry - pressed send before refreshing and didn't see your response. Readability is a very subjective topic. I have an (possibly irrational) aversion to anonymous fns when core fns solve the same problem, so I'm very accustomed to reading things like (partial apply xxx). The perf issue would defin

Re: vec to map with consolidated vals

2013-08-17 Thread David Chelimsky
Hey Steven, here's a variation of my first example that, I think, gets closer to what you're proposing (with maybe-add handled in-line): (defn to-consolidated-map [parts] (reduce (fn [h [k v]] (assoc h k (+ (get h k 0) v))) {} parts)) Using assoc instead of updat

Re: vec to map with consolidated vals

2013-08-17 Thread Steven Degutis
Oh. Wow, I should read the whole thread before posting. Seems like merge-with is what I was looking for. Although, lately both partial and apply make me a little uneasy in terms of efficiency. But that's easily enough solved with an anonymous function, which I don't think is any less readable (mayb

Re: vec to map with consolidated vals

2013-08-17 Thread Steven Degutis
Wow. Sorry for the awful formatting. Re-pasting it from Google Groups (instead of email) to fix it: (def a [[:a 1] [:b 2] [:a 3]]) (defn add-maybe [& nums] (->> nums (remove nil?) (reduce +))) (reduce (fn [m [k v]] (update-in m [k] add-maybe v)) {}

Re: vec to map with consolidated vals

2013-08-17 Thread Steven Degutis
At first I came up with the same solution as your second one. But I couldn't help but feel that it wasn't descriptive enough. It felt too incidental-complexity-ish. To me, (into {} the-map) seems mostly right. But obviously it would just squash the values you need. So I figured it should just be m

Re: vec to map with consolidated vals

2013-08-17 Thread Sean Corfield
Ah, I misunderstood your requirements, but I'm glad it led you in the right direction! On Fri, Aug 16, 2013 at 10:40 PM, David Chelimsky wrote: > Thanks for the suggestions Sean and Ben. I learned new functions from both > of you! > > Sean, your suggestion yields the following: > > (to-consolidat