
-----------------------------------
Insectoid
Wed Mar 10, 2010 9:46 pm

Why can't programmers...program?
-----------------------------------

100.times do |n|
	if (n%5 == 0 && n%3 == 0) then
		puts "FizzBuzz"
	elsif (n%3 == 0) then
		puts "Fizz"
	elsif (n%5 == 0) then
		puts "Buzz"
	else 
		puts n
	end
end


This took  n 100) (void))
    (display
      (case (modulo n 15)
        [(0) "FizzBuzz"]
        [(5 10)  "Fizz"]
        [(3 6 9 12)  "Buzz"]
        [else n]))
    (newline))
[/code]

-----------------------------------
Insectoid
Fri Mar 12, 2010 1:38 pm

RE:Why can\'t programmers...program?
-----------------------------------
*sigh* I give up.

-----------------------------------
TheGuardian001
Fri Mar 12, 2010 1:51 pm

Re: Why can't programmers...program?
-----------------------------------
Apparently all the programmers here can do nothing but program...

-----------------------------------
chrisbrown
Fri Mar 12, 2010 2:09 pm

RE:Why can\'t programmers...program?
-----------------------------------
@PR: Wow, I'm gonna go crawl into my hole now. I knew there had to be a better way. I guess I should stop coding drunk.

On the plus side, I didn't know build-list consumed a function, that's going to be handy.

@Insectoid, programmers are strange, they (we?) really only want to know that we can solve the given problem. When I read an article like that, I think, "Oh look, it's high school all over again where apparently only 1% of people can write code." To be honest, I've put in enough time helping others with simple programs, now I just want to code.

-----------------------------------
jbking
Fri Mar 12, 2010 3:45 pm

Re: Why can't programmers...program?
-----------------------------------
Coming up with the code is only part of the battle here, though.  Being able to explain why the code is as good as it is and handle possible criticisms of a solution are other factors.

-----------------------------------
Prabhakar Ragde
Fri Mar 12, 2010 4:19 pm

Re: Why can't programmers...program?
-----------------------------------
methodoxx: It's okay, what you did was reasonable if you wanted to avoid multiple functions or explicit recursion and you didn't know about build-list. And I did note the time on your post.

Insectoid: You might have kept the discussion more focussed if you hadn't posted your own solution (but maybe not, this is the Internet after all).

Why can't Johnny program? (And it is Johnny, not Jill, alas.)

There are plenty of places in this world where people are encouraged to get something done in a blind fashion rather than understand what they are doing so that they can reliably get a variety of things done. Or if not encouraged, at least not discouraged. 

You would think that a university CS course would not be one of those places, but (a) the diagnosis and assessment tools I can use with the resources I have are inadequate to encourage the right behaviour, and (b) if they were adequate and found that, say, half the class needed to repeat in order to come up to standards, I would come under considerable pressure to let most of them through anyway.

In a credit system, the responsibility to ensure quality is diffused. The one person who has the most responsibility (and the most to lose) is the person being educated. But how to get them to realize that and act on it appropriately?

-----------------------------------
Prabhakar Ragde
Fri Mar 12, 2010 5:28 pm

Re: Why can't programmers...program?
-----------------------------------
At the risk of further annoying Insectoid... this one is fun. Haskell, of course.

[code]
every n s = zipWith ($) $ cycle $ replicate (n-1) id ++ [const s]
main = putStr . unlines .
       (every 15 "FizzBuzz") . (every 5 "Fizz") . (every 3 "Buzz") $
       map show [1..100]
[/code]

-----------------------------------
Turing_Gamer
Mon Mar 22, 2010 7:26 am

RE:Why can\'t programmers...program?
-----------------------------------
I agree with you TheGuardian. Apparently that is all we can bascially do.

-----------------------------------
USEC_OFFICER
Mon Mar 22, 2010 11:37 am

RE:Why can\'t programmers...program?
-----------------------------------
You meantion (Can't spell) a test like this, then everybody wants to prove that they can do it.
