Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by ericbb on Friday January 06, 2012 @01:17PM
(#3434352)
Hehe. That's quite a monster. I'll try to be a bit more helpful.
1. Use loop instead of dotimes so you can make the index range over 1-100 instead of 0-99.
2. Factor out the string calculation so you only need one print statement.
3. Maybe use zerop.
4. Don't write ")(". Use a space in between.
Example:
(loop for n from 1 to 100
do (format t "~a~%"
(cond
((and (zerop (mod n 3))
(zerop (mod n 5)))
"FizzBuzz")
((zerop (mod n 3)) "Fizz")
((zerop (mod n 5)) "Buzz")
(t (format nil "~a" n)))))
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers
by digitailor on Friday January 06, 2012 @04:00PM
(#3435000)
Thanks!
With the macro you can use arbitrary divisors though ;)
Any desire to refactor that beast?
The call is