Hi Stuart,

Couldn't your frames function benefit from using (when) instead of (if)
(making it clear that the alternative is nil), and also, (when-let [rolls
(seq rolls)]) instead of just (when rolls), which may be more robust and
seems more idiomatic when used in conjunction with lazy-seq ?

BTW, I did on my laptop something similar to what you did, and then I read
Mark's answer, and well, he has some good points also :-)


(defn frames
  "Converts a sequence of rolls to a sequence of frames"
  [rolls]
  (if rolls
    (lazy-seq (cons (take (balls-to-score rolls) rolls)
                    (frames (drop (frame-advance rolls) rolls)))))



2009/7/20 Stuart Halloway <stuart.hallo...@gmail.com>

>
> Uncle Bob Martin, a very well-respected OO and agile guy, is learning
> Clojure. He has posted an example [1] and asked for feedback from the
> Clojure community. I have made my suggestions in code [2] and will be
> writing them up shortly.
>
> Would love to see what other folks on this list have to say. If you
> look at my version, it is worth walking through the commits one by one
> to see the changes I made in going from an OO accent to more "Sequence-
> Oriented Programming."
>
> Cheers,
> Stu
>
> [1]
> http://blog.objectmentor.com/articles/2009/07/19/uncle-bob-jsps-learning-clojure
> [2] http://github.com/stuarthalloway/clojure-bowling
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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