Clojure Group

2013-07-06 Thread Michael Sadler
Hello, I came across the Clojure group via a blog and didn't want to spam it and decided to contact you directly. I'm wondering if this can be posted to the group: #Metricata makes the software engineering process measurable and repeatable. ses.newventurewebsites.com Looking forward,

Domain modelling question

2013-07-06 Thread Marc Schneider
Hello, I'm trying to implement some business model in Clojure. I have several years of experience developing OO systems in Java. So it's still very hard to wrap my head to functional thinking. I hope you can help me with following questions. I need a domain model for customers, contracts and

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread Sean Corfield
On Fri, Jul 5, 2013 at 8:53 PM, Carlo Zancanaro carlozancan...@gmail.com wrote: Is there a reason you don't use the database's table/column name quoting? It means that keywords like :first-name cannot be used as table names without a fair bit of trouble. The DSL in java.jdbc supports

Re: Clojure Group

2013-07-06 Thread Marcus Lindner
If it uses clojure or is for clojure and with more information about the product I think there speak nothing agianst it, if you post it. It is not so good to register before you can get any information about the product, so more infos are needed. VG Marcus Am 05.07.2013 19:37, schrieb

Re: Domain modelling question

2013-07-06 Thread Chris Ford
I find the modelling Clojure data structures very similar to working out what your aggregates roots are for domain-driven design or using a document data store. I would suggest avoiding using refs in a customer map. In this case, it sounds like customer is your natural aggregate root, so you

Re: Domain modelling question

2013-07-06 Thread Alex Baranosky
Hi Marc, But the domain model I'm thinking of has lots of mutable things that change over time when I execute the business actions. In your case, you don't need any STM to model any of your domain. I'd go so far as to say that to use refs for this is almost certainly a mistake. Of course the

core.async go - out of memory

2013-07-06 Thread MikeM
Got an out of memory when experimenting with core.async channels in go blocks. The following is a simple example. (defn go-loop [] (let [c0 (chan)] (while true (go (! c0 1)) (go (println (! c0)) ;(.start (Thread. go-loop)) Clojure 1.5.1, Java 1.7.0_25 32-bit running under

Ring's session cookie-store

2013-07-06 Thread Alexander Solovyov
Hi all, I wrote a small site using compojure and friend and naturally I used ring's own wrap-session to handle sessions. My code looks like this: (def app (- app-routes (friend/authenticate {:credential-fn (partial creds/bcrypt-credential-fn

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread r0man
Composing queries is done via compose. Take a look here: https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L16 On Saturday, July 6, 2013 5:46:06 AM UTC+2, Carlo wrote: Hey Roman, The issue that I see with `sqlingvo`, and the thing which I was trying to solve for

Re: New CSS library - Garden

2013-07-06 Thread Steven Degutis
So far, I really like Garden. There's one thing though that's making it difficult. It's hard to see that nested rules are nested. ;; hard to see nesting[:footer {:color red :background-color blue} [:a {:color green}]] ;; much easier(:footer {:color red :background-color

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread Carlo Zancanaro
This is a fairly restricted composition, though: (def triangles (compose (select [:color :num_sides] (from :shapes)) (where '(= :num_sides 3 (def green-triangles (compose triangles (where '(= :color green (sql green-triangles) ;=

Walking a tree

2013-07-06 Thread looselytyped
Good morning everyone! I have a problem that I have been struggling with for a few days now. I have a directed acyclic graph that I am trying to walk, and can't seem to figure out a to prevent my walking already visited branches. Here is the code (def values [{:v a :parent [b]} {:v b

Re: Walking a tree

2013-07-06 Thread Stanislav Sedov
On Jul 6, 2013, at 9:33 AM, looselytyped raju.gan...@gmail.com wrote: Good morning everyone! I have a problem that I have been struggling with for a few days now. I have a directed acyclic graph that I am trying to walk, and can't seem to figure out a to prevent my walking already

Re: Offline Clojure docs

2013-07-06 Thread Tom Faulhaber
Sorry, my second method should have been: $ curl -L https://github.com/clojure/clojure/archive/gh-pages.tar.gz | tar xvzf - Enjoy! Tom On Sunday, June 30, 2013 7:44:17 PM UTC-4, David Pollak wrote: Folks, Is there an offline package of Clojure docs (the full core.* api docs, cheat

Re: New CSS library - Garden

2013-07-06 Thread Steven Degutis
Oh, two more things. First, it would be really cool to have a tool to convert CSS to GardenCSS. MichaƂ Marczyk suggested using Instaparse with the CSS3 grammar, which sounds like a really easy way to make this happen. Unfortunately I don't have the time or skill to do it, but if anyone else does,

Re: Walking a tree

2013-07-06 Thread Carlo Zancanaro
Give this a go: (defn ^:private walk-tree* [all seen to-do] (when-let [[curr others] to-do] (if (contains? seen curr) (recur all seen others) (lazy-seq (when-let [node (first (filter #(= (:v %) curr) all))] (println node) (cons curr

Re: Walking a tree

2013-07-06 Thread looselytyped
Dear Stanislav, Thank you. You got me going down the right path. Upon looking around for a BFS solution, I came across this blog post http://hueypetersen.com/posts/2013/06/25/graph-traversal-with-clojure/that had me going down the right direction. Which leads me to Carlo's response -- You

Re: [ANN] clojure-sql 0.1.0: relational algebra in clojure

2013-07-06 Thread r0man
You can do this with the second argument to the where function. I added an example here: https://github.com/r0man/sqlingvo/blob/master/test/sqlingvo/test/core.clj#L24 On Saturday, July 6, 2013 4:02:23 PM UTC+2, Carlo wrote: This is a fairly restricted composition, though: (def triangles

Jenkins/leiningen trigger build when a snapshot gets updated

2013-07-06 Thread Trevor Bernard
Hi, Does there exist a Hudson/Jenkins plugin for leiningen to trigger a build when a SNAPSHOT dependency gets updated? Warmest regards, Trevor -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: core.async go - out of memory

2013-07-06 Thread David Nolen
This isn't a bug, you're in a infinite loop constructing go blocks. You should probably move the loops into the go blocks. David On Sat, Jul 6, 2013 at 7:31 AM, MikeM michael.messini...@invista.comwrote: Got an out of memory when experimenting with core.async channels in go blocks. The

Re: core.async go - out of memory

2013-07-06 Thread MikeM
On Saturday, July 6, 2013 11:46:51 AM UTC-4, David Nolen wrote: This isn't a bug, you're in a infinite loop constructing go blocks. You should probably move the loops into the go blocks. I assumed go blocks are garbage collected when they go out of scope, but maybe I don't understand

Re: core.logic - Using featurec to describe relationships around keys in a map

2013-07-06 Thread Norman Richards
On Fri, Jul 5, 2013 at 1:06 PM, David Rocamora dro...@gmail.com wrote: I'm trying to use featurec to describe some relationships within a nested map. When I try to use it to find some keys in the map it returns nothing. Here is an example: I don't believe you can match on the keys in a map

Most idiomatic way of splitting a string into sentences?

2013-07-06 Thread Denis Papathanasiou
I have a plain text file containing an English-language essay that I'd like to split into sentences, based on the presence of punctuation. I wrote this function to determine if a given character is an English punctuation mark: (defn ispunc? [c] ( (count (filter #(= % c) '(. ! ? ;))) 0)) I

Most idiomatic way to split a string into sentences by punctuation?

2013-07-06 Thread Denis Papathanasiou
I have a plain text file containing an English-language essay I want to split into sentences, based on common punctuation. I wrote this function, which examines a character and determines if it's an end of sentence punctuation mark: (defn ispunc? [c] ( (count (filter #(= % c) '(. ! ? ;)))

Re: Most idiomatic way of splitting a string into sentences?

2013-07-06 Thread Lars Nilsson
On Sat, Jul 6, 2013 at 11:42 AM, Denis Papathanasiou denis.papathanas...@gmail.com wrote: (def my-text (slurp mytext.txt)) (def my-sentences (partition-by ispunc? my-text)) Unfortunately, this returns a sequence of 1, whose first and only element contains the entire text, since ispunc?

Re: Most idiomatic way to split a string into sentences by punctuation?

2013-07-06 Thread Jim - FooBar();
I use this regex usually it's been a while since I last used it so I odn't remember how it performs... #(?=[.!?]|[.!?][\\'\])(?!e\.g\.|i\.e\.|vs\.|p\.m\.|a\.m\.|Mr\.|Mrs\.|Ms\.|St\.|Fig\.|fig\.|Jr\.|Dr\.|Prof\.|Sr\.|[A-Z]\.)\s+) and as Lars said all you need is clojure.string/split Jim On

Re: Ring's session cookie-store

2013-07-06 Thread Thomas Heller
Hey, cookie-store does not expect a string but a map like (cookie-store {:key your-key}) otherwise it will generate a random new key each restart, which you observed. You can also set some options for the cookie itself, see :cookie-attrs

Re: core.async

2013-07-06 Thread dennis zhuang
It's so cool,great job! But i don't find any way to do io blocking operations such as socket.read in 'go'. Is there a roadmap to make alts! working with java NIO selector that waits on socket channels? Then we can read/write data with socket/file channel in go without blocking. Thanks,it's really

Re: core.async go - out of memory

2013-07-06 Thread Timothy Baldridge
Go blocks are GC'd but not until they complete running. The problem is that you're creating go blocks faster than they can run. Creating go blocks is very cheap, taking/putting into channels is also cheap but not quite as cheap. Therefore the outer loop will eventually allocate so many blocks that

Re: Ring's session cookie-store

2013-07-06 Thread Alexander Solovyov
On Sat, Jul 6, 2013 at 10:07 PM, Thomas Heller th.hel...@gmail.com wrote: Hey, cookie-store does not expect a string but a map like (cookie-store {:key your-key}) otherwise it will generate a random new key each restart, which you observed. You can also set some options for the cookie

ANN Monger 1.6.0 is released

2013-07-06 Thread Michael Klishin
Monger (http://clojuremongodb.info) is a Clojure MongoDB client for a more civilized age. 1.6.0 is a minor release that that makes it easier to work with multiple databases. Release notes: http://blog.clojurewerkz.org/blog/2013/07/06/monger-1-dot-6-0-is-released/ -- MK

Re: core.async go - out of memory

2013-07-06 Thread Laurent PETIT
2013/7/6 MikeM michael.messini...@invista.com: Got an out of memory when experimenting with core.async channels in go blocks. The following is a simple example. (defn go-loop [] (let [c0 (chan)] (while true (go (! c0 1)) (go (println (! c0)) ;(.start (Thread.

core.logic - using membero to generate list?

2013-07-06 Thread Adam Saleh
Hi, I wanted to use featurec to generate hash-map, similarily to a way I use membero when generating lists. i.e = (run 1 [q] #= (membero :a q)) ((:a . _0)) Unfortunately when I try to do something \w it, it throws exception = (first *1) (1 . _0) = (first *1) IllegalArgumentException Don't

ANN Validateur 1.5.0 is released

2013-07-06 Thread Michael Klishin
Validateur (http://clojurevalidations.info) is a data validation library inspired by Ruby's ActiveModel. 1.5 is a minor release that introduces error message customization. Release notes: http://blog.clojurewerkz.org/blog/2013/07/06/validateur-1-dot-5-0-is-released/ -- MK

Re: Most idiomatic way of splitting a string into sentences?

2013-07-06 Thread Denis Papathanasiou
On Saturday, July 6, 2013 1:22:32 PM UTC-4, Lars Nilsson wrote: [snip] If that kind of splitting is really all you require, (clojure.string/split my-text #[.!?;]) or (re-seq #[^.!?;]+ my-text) Thanks! Is there any way to preserve the actual punctuation? That's why I was looking at

Re: Most idiomatic way to split a string into sentences by punctuation?

2013-07-06 Thread Denis Papathanasiou
On Saturday, July 6, 2013 1:54:49 PM UTC-4, Jim foo.bar wrote: I use this regex usually it's been a while since I last used it so I odn't remember how it performs... #

Re: core.logic - using membero to generate list?

2013-07-06 Thread Norman Richards
On Sat, Jul 6, 2013 at 3:16 PM, Adam Saleh adamthecam...@gmail.com wrote: = (run 1 [q] #= (membero :a q)) ((:a . _0)) Unfortunately when I try to do something \w it, it throws exception = (first *1) (1 . _0) = (first *1) IllegalArgumentException Don't know how to create ISeq from:

Re: core.logic - Using featurec to describe relationships around keys in a map

2013-07-06 Thread David Nolen
On Sat, Jul 6, 2013 at 12:27 PM, Norman Richards o...@nostacktrace.comwrote: On Fri, Jul 5, 2013 at 1:06 PM, David Rocamora dro...@gmail.com wrote: I'm trying to use featurec to describe some relationships within a nested map. When I try to use it to find some keys in the map it returns

Re: Ring's session cookie-store

2013-07-06 Thread James Reeves
On 6 July 2013 20:07, Thomas Heller th.hel...@gmail.com wrote: You can also set some options for the cookie itself, see :cookie-attrs ( http://clojuredocs.org/ring/ring.middleware.session/wrap-session) which should fix your expiration issues. In this case it doesn't matter much, but note

Re: Most idiomatic way of splitting a string into sentences?

2013-07-06 Thread Lars Nilsson
On Sat, Jul 6, 2013 at 5:02 PM, Denis Papathanasiou denis.papathanas...@gmail.com wrote: On Saturday, July 6, 2013 1:22:32 PM UTC-4, Lars Nilsson wrote: [snip] If that kind of splitting is really all you require, (clojure.string/split my-text #[.!?;]) or (re-seq #[^.!?;]+ my-text) Is there

Re: core.async go - out of memory

2013-07-06 Thread MikeM
On Saturday, July 6, 2013 4:01:31 PM UTC-4, tbc++ wrote: Go blocks are GC'd but not until they complete running. The problem is that you're creating go blocks faster than they can run. Creating go blocks is very cheap, taking/putting into channels is also cheap but not quite as cheap.

Re: core.async

2013-07-06 Thread Cedric Greevey
The obvious approach is to use a future or other thread as an intermediary between the blocking I/O read and a channel, then use ! on the channel in a go; something like: (go (let [c (chan)] (future (!! c (my-blocking-io-read some-stream))) (let [thingy (! c) (do-something-with

Re: Clojure Group

2013-07-06 Thread Cedric Greevey
I have doubts about the assertion that it can make software engineering ... repeatable, on firm theoretical ground and additionally backed by experience. Programming is not a kind of manufacturing; the manufacturing is done by way if right-drag copy files here, uploading to Github and Sourceforge,

Re: New CSS library - Garden

2013-07-06 Thread Joel Holdbrooks
Hi Steven, I know that readability is a bit of an issue for some people. Unfortunately there isn't much I can do other than point folks to the defrule macro and some of the other suggestions I've made. As I work with the Garden I see problem areas too and am working to find solutions that will

Jenkins/leiningen trigger build when a snapshot gets updated

2013-07-06 Thread Ryan Stradling
I am not aware of one that does that. I end up using a pom style project. As a prebuild step I generate the pom using lein. Then my maven step does a lein validate (basically a dummy step) and then do post build steps that do the lein commands like lein test. It is not a perfect solution

Re: New CSS library - Garden

2013-07-06 Thread Steven Degutis
Right, I understand how defrule works. But I actually do have 27 [i.e. O(n)] distinct rules, so it's not a feasible solution. Because when I write CSS, I only style domain-specific class names (.cart, .license), never mentioning the elements they just so happen to use at the moment (h1, p, a).

Re: New CSS library - Garden

2013-07-06 Thread Joel Holdbrooks
Cool. I'm glad you like the library. Thanks for sharing your kind words and thoughts. :) I admit it's weird that it just vector-izes its arguments, and does nothing else. In that case I don't think you need a macro, just alias rule to vector and you'll achieve the same end. I think it should