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 of
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' opinions
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 Plínio
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 bkurtz@gmail.com wrote:
I saw a rant online about interviewing developers that mentioned
The naïve implementation does sometimes underestimate the total, though.
On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
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}
Why do you say that?
On Tue, May 20, 2014 at 4:16 PM, Ben Wolfson wolf...@gmail.com wrote:
The naïve implementation does sometimes underestimate the total, though.
On Tue, May 20, 2014 at 4:13 PM, Mark Engelberg
mark.engelb...@gmail.comwrote:
You're seriously overthinking this if it's
There are three vowels in naïve, not two.
On Tue, May 20, 2014 at 4:19 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
Why do you say that?
On Tue, May 20, 2014 at 4:16 PM, Ben Wolfson wolf...@gmail.com wrote:
The naïve implementation does sometimes underestimate the total, though.
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 moderated
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
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, May 20, 2014 at 10:02 PM, Brad Kurtz bkurtz@gmail.com 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
11 matches
Mail list logo