Why this difference between nrepl and standalone jar?

2013-09-12 Thread Denis Papathanasiou
I've got a simple function which loops through a list of strings, accumulating the total length of each, and returning a summary tuple based on some criteria. The last part of the function looks like this: (loop [eligible-strings eligible-strings, counted-length 0, ind -1] (if (=

Is this idiomatic for a recurring function?

2013-07-09 Thread Denis Papathanasiou
Hi, I'm new to clojure and I'd like to know if this is the best/idiomatic way of solving this particular task: I have a list of strings of variable length, and I want to find the position or index number of the list whose cumulative size from the head of the list matches a given target number.

Re: Is this idiomatic for a recurring function?

2013-07-09 Thread Denis Papathanasiou
Hi, and thanks for your reply. On Tuesday, July 9, 2013 4:41:36 PM UTC-4, puzzler wrote What you're looking for is: (defn get-length-match [my-list target-length] (loop [my-list my-list, counted-length 0, ind -1] ...)) In your recur, you can now omit target-length, but the rest

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

2013-07-07 Thread Denis Papathanasiou
On Sunday, July 7, 2013 6:06:06 AM UTC-4, Jim foo.bar wrote: I'm not sure I follow what you mean...both regexes posted here preserve the punctuation...here is mine (ignore the names - it is in fact the same regex): You're right; I was actually referring to the suggestions Lars had made.

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 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... #