Looks like the barber's loop doesn't check the "running" atom, so it will 
never stop...

If you wanted to get rid of the atom for counting haircuts you could use a 
go-loop with a haircut count as an argument. Something like:

(go-loop [haircuts 0]
  (if @running
    (do (cut-hair!)
        (recur (inc haircuts)))
    haircuts))

Other than that, I'd find it easier to understand what the program was 
doing if you extracted out some of the code into functions named in the 
language of the domain. Even if all the cut-hair! function contains is (<!! 
(async/timeout 20)) it makes it easier to understand what that timeout 
*means*. Similarly, you could probably come up with a name for the channel 
passed to the barber function that's a bit more descriptive than "c" :-).

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to