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

2013-07-06 Thread Lee Hinman
On 07/06/2013 09:42 AM, Denis Papathanasiou wrote: > 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. If you want a natural language processing-based version of the a sentence detector, clojure-opennlp[1] h

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 shou

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). Thi

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 but

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

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 Sourcefor

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: 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: 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 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 any way to

Re: Ring's session cookie-store

2013-07-06 Thread James Reeves
On 6 July 2013 20:07, Thomas Heller 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 that the Ring docs

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 wrote: > > On Fri, Jul 5, 2013 at 1:06 PM, David Rocamora 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:

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 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: > clojure.

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... > > # > "(?<=[.!?]|[.!?][\\'\"])(? ) > > and as Lars said all you need is clojure.string/split > Thanks, though as I repli

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 loo

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 http://github.com/mich

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 Do

Re: core.async go - out of memory

2013-07-06 Thread Laurent PETIT
2013/7/6 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 ( > ;(.start (Thread. go-loop)) > > Clojure 1.5.1, Java 1.7

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 http://github.com/michael

Re: Ring's session cookie-store

2013-07-06 Thread Alexander Solovyov
On Sat, Jul 6, 2013 at 10:07 PM, Thomas Heller 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 itself, see :cook

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: 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 a

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 (http://clojuredocs.org/ring/ring.middleware.session/wra

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... #"(?<=[.!?]|[.!?][\\'\"])(?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

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 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? depends on looking at a singl

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) '("." "!" "?" ";")))

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: 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 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 - only the v

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 understan

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 wrote: > Got an out of memory when experimenting with core.async channels in go > blocks. The following is a simple example. > >

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 clojure@googleg

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 (

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 that had me going down the right direction. Which leads me to Carlo's response -- You a

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 (walk

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: 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: Walking a tree

2013-07-06 Thread Stanislav Sedov
On Jul 6, 2013, at 9:33 AM, looselytyped 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 visited branches. Here

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

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) ;=> ["S

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-col

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

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

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 (http://groups.google.com/group/clojure?hl=en --- You received this message because you are su

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

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 shoul

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 Mic