So Sup Forums, what distinguishes a good programmer from a bad one?

So Sup Forums, what distinguishes a good programmer from a bad one?

comments

The amount of hair on his neck.

...

What's wrong with the * operator?

gotta unroll your loops

It's a programming challenge to write something without using X

I assume the 'right' way to do this exercise would be like this.

def mul(a, b):
ret = 0
while b != 0:
ret += a
b -= 1
return ret


I guess the idea is to show an understanding of how to implement a multiplication algorithm? (The answer there shows a serious lack of understanding of the basic principle of abstraction, so it's indicative of *something*.)

Also, inb4 not handling non-integers or negative numbers.

holy fukken jesus. This can't be real

Everyone who I've seen try to do this one never does it without a loop and it makes me cringe. Here's the my one line version in c#

public static int Product(int a, int b) {
return (b == 0) ? 0 : a + Product(a,b-1);
}

that's 3 lines; where did you learn to count?

You know you can put the header and closing bracket in the same line with the code, right? It's a return statement, not lambda calculus. I put it in 3 separate lines for readability because I'm on my phone like a lot of people and scrolling horizontally is shitty.

>recursion is better than iteration
what the fuck?
are you retarded?

Oh, now I get it, the asterisk is multiple sign, not the pointer

The """"correct"""" way to do that would be loading a list of those numbers from a CSV file and checking against each one using a loop

stupid idiot

>m-muh clock speed
What kind of shitty CPU are you running that the speed of an extra nanosecond to compute recursively is noticeable compared to a loop? There's no point in wasting lines on looping when you can do it in a return line using the null check operators.

>:^)

>fuck speed
>fuck readability
>fuck languages with no tail recursion optimization
hello pajeet

Just use sieve of eratosthenes or, at least brute force the damn thing

you must be a cs course student

Why the fuck should I care about having more or less lines and not about performance? Are you retarded?

The ""correct"" way would be using a modified sieve of eratosthenes to generate the first n primes along with their co-primes.

O(sqrt(n)), but better than THAT.

>wat is golfing

Pajeet thinks not having a CS degree is like a badge of honour. Paheet have no time for you.

Your shitty Pajeet attitude is why some much software is pure shit these days. Poo in the loo... more like poo in the software.

This guy gets it.

(You)'s

>what is stack