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