keep is cool, thanks for showing me that :)
On Wednesday, May 21, 2014 2:35:50 AM UTC-5, Vesa Marttila wrote:
>
> On Wednesday, May 21, 2014 2:03:14 AM UTC+3, Brad Kurtz wrote:
>>
>> I saw a rant online about interviewing developers that mentioned
>> candidates not being able to count the number
My one cent:
(defn count-vowels
([^String text]
(count-vowels text "aeiouAEIOU"))
([^String text ^String accepted-vowels]
(let [vowel? (set accepted-vowels)]
(->> text
(filter vowel?)
count
user=> (count-vowels "Plínio Balduino")
6
user=> (count-vowels
On Wednesday, May 21, 2014 2:03:14 AM UTC+3, Brad Kurtz wrote:
>
> I saw a rant online about interviewing developers that mentioned
> candidates not being able to count the number of vowels in a string. So
> naturally, I decided to see if I could do it in Clojure!
>
> I wanted to see others' opin
On Tue, May 20, 2014 at 10:02 PM, Brad Kurtz wrote:
> I like the one-liner. That was the kind of feedback I was looking for,
> thanks.
>
>
> On Tuesday, May 20, 2014 6:13:48 PM UTC-5, puzzler wrote:
>
>> You're seriously overthinking this if it's any more than a one-liner.
>>
>> (defn count-vowel
I like the one-liner. That was the kind of feedback I was looking for,
thanks.
On Tuesday, May 20, 2014 6:13:48 PM UTC-5, puzzler wrote:
>
> You're seriously overthinking this if it's any more than a one-liner.
>
> (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U}
> (seq s))
On Tue 20 May 2014 at 04:22:17PM -0700, Ben Wolfson wrote:
> There are three vowels in "naïve", not two.
And watch out for those un-normalizable combining character
combinations!
Also, another one-liner:
(defn ascii-vowel-count [s] (count (re-seq #"(?i)[aeiou]" s)))
Doing this in a multili
To say nothing of "y":
yes -> one vowel
any -> two vowels
but the filter thing is good otherwise.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are mode
There are three vowels in "naïve", not two.
On Tue, May 20, 2014 at 4:19 PM, Mark Engelberg wrote:
> Why do you say that?
>
>
>
> On Tue, May 20, 2014 at 4:16 PM, Ben Wolfson wrote:
>
>> The naïve implementation does sometimes underestimate the total, though.
>>
>>
>> On Tue, May 20, 2014 at 4:
Why do you say that?
On Tue, May 20, 2014 at 4:16 PM, Ben Wolfson wrote:
> The naïve implementation does sometimes underestimate the total, though.
>
>
> On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg
> wrote:
>
>> You're seriously overthinking this if it's any more than a one-liner.
>>
>> (d
The naïve implementation does sometimes underestimate the total, though.
On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg wrote:
> You're seriously overthinking this if it's any more than a one-liner.
>
> (defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U}
> (seq s
>
>
> On
You're seriously overthinking this if it's any more than a one-liner.
(defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} (seq
s
On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz wrote:
> I saw a rant online about interviewing developers that mentioned
> candidates not being a
I saw a rant online about interviewing developers that mentioned candidates
not being able to count the number of vowels in a string. So naturally, I
decided to see if I could do it in Clojure!
I wanted to see others' opinions on other ways of doing it.
*https://gist.github.com/bradkurtz/6ce500
12 matches
Mail list logo