On Tue, May 20, 2014 at 10:02 PM, Brad Kurtz <[email protected]> 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-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U}
>> (seq s))))
>>
>
Great, glad it was helpful. Actually, you can remove the call to seq,
since filter calls it implicitly:
(defn count-vowels [s] (count (filter #{\a \e \i \o \u \A \E \I \O \U} s)))
>
>>
>> On Tue, May 20, 2014 at 4:03 PM, Brad Kurtz <[email protected]> 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 on other ways of doing it.
>>>
>>> *https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e
>>> <https://gist.github.com/bradkurtz/6ce500d0361ccdc08c8e>*
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to [email protected]
>>>
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.