Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-31 Thread Thomas
Just to bring this one back to topic; here is another FizzBuzz, this time no cond/if statement: (def three (cycle [nil nil fizz])) (def five (cycle [nil nil nil nil buzz])) (map vector (range 1 16) three five ) ;([1 nil nil] [2 nil nil] [3 fizz nil] ... Thomas -- You received this message

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-30 Thread Meikel Brandmeyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Am 30.12.12 07:14, schrieb Laurent PETIT: `when` provides an implicit `do`, so I generally try to only use it when I want side-effects. (Other side-effecty forms include `do`, `doseq`, `dotimes` and `when-not`.) On the other end, using when

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-30 Thread Mark Engelberg
On Sun, Dec 30, 2012 at 4:32 AM, Meikel Brandmeyer m...@kotka.de wrote: (when-let [s (seq coll)] (do-stuff-with s)) I would find when-let a lot more useful if it worked with multiple bindings, e.g., (when-let [x blah1 y blah2 z blah3] (+ x y z)) should

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-30 Thread Ben Wolfson
If-let would be confusing if it handled multiple bindings, since you wouldn't know how much had succeeded when you executed the else branch. That doesn't apply to when-let; fortunately it's quite simple to write one that does do multiple bindings in terms of the existing when-let, and it would

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-29 Thread Nikita Beloglazov
Hi I'd change your fizzy function so it returns a string instead of printing it. This way it will be pure function and more functional-like. In doseq you'll need (printlng (fuzzy x)) instead of (fuzzy x). Nikita Beloglazov On Saturday, December 29, 2012 3:35:38 PM UTC+3, Sean Chalmers wrote:

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-29 Thread Sean Chalmers
Yay! Thanks for the feedback everyone. I originally had it as a 'cond' but because I was using 'println' directly in my fizzy function I was getting on 15 for example fizzbuzz, buzz, fizz but changing it to more pure function would probably deal with that. I'll have a play with 'when' as well,

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-29 Thread John Gabriele
On Saturday, December 29, 2012 5:15:49 PM UTC-5, Sean Chalmers wrote: ... but changing it to more pure function would probably deal with that. Another benefit of pure functions is that they're easier to test. I'll have a play with 'when' as well, hadn't tried that one yet. `when`

Re: Unseemingly Eager Clojure Apprentice Seeking FizzBuzz Feeback

2012-12-29 Thread Laurent PETIT
2012/12/30 John Gabriele jmg3...@gmail.com: On Saturday, December 29, 2012 5:15:49 PM UTC-5, Sean Chalmers wrote: ... but changing it to more pure function would probably deal with that. Another benefit of pure functions is that they're easier to test. I'll have a play with 'when' as