In the interest of becoming a "better programmer", what about the
following approach?  I'm a Clojure newbie, so this seems like a good
opportunity for some critique.

(defn odds [xs]
  (map first
    (filter
      #(odd? (count %))
      (vals
        (group-by identity (sort xs))))))

I see now that I could have used the frequency function, and it seems
like my lambda could be cleaned up a bit...

On Jan 17, 2:40 pm, James Reeves <jree...@weavejester.com> wrote:
> On 17 January 2012 22:10, Dennis Haupt <d.haup...@googlemail.com> wrote:
>
> > in the end, the program must work down to the lowest level and there
> > cannot be unanswered questions. but take a look at the 3 solutions given
> > until now. in 2 cases, all i read is "do this, then that, i don't care
> > how". in the third, a hashset was picked. but it didn't have to be one.
> > any non-map-collection type would have worked here.
>
> I'm not sure I entirely follow you...
>
> It's probably true that some people overcomplicate problems, but I
> don't think this is a side-effect of experience, assuming that is what
> you're implying.
>
> In my experience, it's the other way round: simplicity tends to come
> with experience.
>
> - James

-- 
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 - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to