ITT post programming meme

ITT post programming meme

Other urls found in this thread:

rosettacode.org/wiki/Sorting_algorithms/Sleep_sort
en.wikipedia.org/wiki/Multiplicative_inversehttps://en.wikipedia.org/wiki/Identity_element
en.wikipedia.org/wiki/Multiplicative_inverse
en.wikipedia.org/wiki/Identity_element
news.ycombinator.com/item?id=2657736
archive.tinychan.org/read/prog/1295544154
twitter.com/NSFWRedditImage

Best programming meme hehe

for(int i = 1; i

if(a == 1){
if(b == 2){
// do something here
}
}

i

you right
i did i = 0 originally

yeah we're so used to starting at 0 and going to 1 less than the end number since that's how arrays and stuff works ig

It's funny how in some languages this is actually faster performance-wise

worst programming meme ever

Real code (tm)

Name a language that combines spaces like that so I can avoid it

It's probably a font

That's actually a=b*a;
dumb fuckers hahaha

dude...
first of all a *= b is nicer the point is that "she" could just have used a loop for that

this is bad baiting

const foo = (a, b) =>
a.toString()
.repeat(b)
.split('')
.reduce((t, x) => t + parseInt(x), 0)


How can brainlets even compete?

H,How did you do that!?

HAHAAHA LMAOIN @ UR LIFE
O(2^n) [n being the amount of digits of b] is not even close to good performance. Check this out:
int i = 0;
int m = 1;
int res = 0;
while(m>0){
if(m&b){
res = res + (a

>imperative

IMUL a,b

html isn't programming language

int Product(int a, int b) { return (int)(a / (1 / (double)b)));}

why else if ladders are discouraged?

This is amazing. Why does it work??

>pointless, inefficient type conversions
>brainlet

maths. its the same at multiplication. basic algebra. good answer though

const foo = (a, b) =>
new Array(b)
.fill(a)
.reduce((t, x) => t + x, 0)


Happy now?

>imperattive sequential brainlets

#include
int mult(int a, int b){
return (b == 1) ? a : a+mult(a,b-1);
}
int main(){
std::cout

Should I feel bad about not understanding half of what's happening here? I've been programming for fun for about a year and am interested in going further. Learning java at school and python on the side.
Anything I should know or any books I should read?

it's better, but now you're pointlessly allocating memory and still using a deadshit faggot language.

why is this guy the only one to just do a simple recursive answer

#include
#include

class string
{
private:
int size;
char *ptr;

string() : size(0), ptr(new char[1]) { ptr[0] = 0; }

string(const string &s) : size(s.size)
{
ptr = new char[size + 1];
strcpy(ptr, s.ptr);
}

~string()
{
delete [] ptr;
}

friend ostream &operator

>Should I feel bad about not understanding half of what's happening here?
Not really, we're just memeing to the extreme because it's fun to attempt this in retarded but difficult ways.

>Anything I should know or any books I should read?
Make things. Make lots of things. You won't learn much unless you try to make things. Then try to make everything that you make a little better each time you make something.

If you're just listening to a class or following tutorials, you aren't going to learn shit. Start a (small) project!

rosettacode.org/wiki/Sorting_algorithms/Sleep_sort

>le recursion meme

>return (b == 1) ? a : a+mult(a,b-1);
>why
This answer hurts my tiny little pea brain. I can't into recursion.

In Julia, assuming unsigned integers with wrapping addition and subtraction:
multiply(x,y) = if (0==y) 0 else
(0 - y&1)&x + multiply(x,y)

oh my god Julia is so gad damn awful

REEEEEEEEEEEEE
const foo = (a, b, t = 0) =>
b ? foo(a > 1, b & 1 ? t + a : t) : t


GOOD ENOUGH?

How can I make that fancy white textbox?

[ code ]
...
[ /code ]

without whitespaces in [ ]

nigga
[]nigga
[ ]nigga
[][]nigga
nigga

Here is the 3rd grade explanation that you should already know:

1/5, is one fifth.

1 / (1/5), basically saying "how many times does one fifth go into one", which we can easily see is 5 times.

So if we change 1, to 2 then

2 / (1/5) we are saying "how many times does 1/5th go into 2, which is 10".

We can see here that a = 2 and b = 5, and the result is 10.

Or using higher order functions, for 64 bit unsigned, implicitly parallel:
multiply(x,y) = mapreduce(+,0,1:64) do i
(0-(y >> i&1)&x

Wow you are a wizard. Thanks

en.wikipedia.org/wiki/Multiplicative_inversehttps://en.wikipedia.org/wiki/Identity_element
If you can't understand then try khan's academy.

>muh pajeet
You are worse than pajeet

DEFINE true = FALSE
DEFINE false = TRUE

>how many times does one fifth go into one
This should probably say "how many times does one go into one fifth" but I get your point.

Oops, forgot parentheses:
multiply(x,y) = mapreduce(+,0,1:64) do i
(0-(y >> i)&1)&x (0-(y >> i)&1)&x

>en.wikipedia.org/wiki/Multiplicative_inversehttps://en.wikipedia.org/wiki/Identity_element


en.wikipedia.org/wiki/Multiplicative_inverse
en.wikipedia.org/wiki/Identity_element

This is very impressive stuff

>>muh pajeet
>You are worse than pajeet
Programming =/= Mathematics. I've never, ever needed to know this for my work. Only one person posted a solution with division so... that says it all really. Thanks for the help though.

>implying multiplication is not just reverse division
>implying left shift is different from right shift

yea no

How the fresh fuck did you pass elementary shool though?

But floats are not associative. Your answer will be less precise than an actual mul instruction.

Also, it doesn't work for rings that are not fields, like integers.

it is, only declarative and not turing-complete

I didn't. Who needs all the bullshit they teach there in programming?

HTML + CSS is actually turing complete though.

And you were doing so well.

Are you over 12?

>HTML + CSS is actually turing complete though.
proof? You can't calculate anything with html or css.

IIRC, you can make it show a rule 110 automaton, which is turing complete.

...I've never thought about it.

xD
This is more funny than post you replied to

>a+= a;

2a
4a
8a
16a
...

BECAUSE FUCKING RECURSIVITY ISNT """SIMPLE""".
What the fuck. His () "solution" gives you a stack overflow for any b of big enough size.

Few LOC != Good Program

I also posted a recursive solution and everyone ignored it and it made me sad because it took me some minutes Senpai, please notice me

Yea I was going to answer you already.
I'm () btw.
Even though I hate recursivity I really like your implementation. It took me some time to figure out what you did. Its pretty awesome and if you look at the time it needs it is way better than .

General assessment:
(me)
Time needed O(n)
RAM needed O(1)

Time needed O(n)
RAM needed O(n)

Time needed O(n^2)
RAM needed O(n^2)

n being the number of digits of b.

>
>Time needed O(n^2)
>RAM needed O(n^2)


Sry fucked up. Meant to say O(2^n). Its the exponential behaviour that makes it so fucking stupid.

Thanks! Nice to see that someone else also took the bitwise approach. I try to avoid using loops, that's the reason I went with recursion after people didn't like my array based solutions. Though, the array/concatenation thing was a bit of a tongue-in-cheek nod to the solution in OP image.

>private: EVERYTHING
?

>discussing runtime performance for a staged extremely constructed problem

its not about performance. its about solving a problem in a creative and elegant way.

(me)
>Time needed O(n)
???

also i see at least 2 logic errors and 3 compilation errors

coding with klossy

>I've been programming for fun for about a year
dude holy shit, how can you not understand what is basically verbose multiplication

>Anything I should know or any books I should read?

You just opened my eyes, this is why I can't draw... it's because I'm being retarded exactly like this... fuck, I think I can make it now

this originated on /prog/... truly sad how we lost the only place on the internet where only EXPERT PROGRAMMERS would meet

I know. I tried finding an archive of the original thread but I was lazy so I posted that instead.
The HN thread discussing it never fails to make me laugh, though. Especially this post news.ycombinator.com/item?id=2657736

>archive
If you find a /prog/ archive, please let me know.

archive.tinychan.org/read/prog/1295544154
There you go. I was really lazy but I'm better now.

Looks like I have to fire up wget.

>>Time needed O(n)
>???
?????????

>2 logic errors and 3 compilation errors
Which compiler do you use?
Also this obviously needs to be in a context where a and b is defined.
Also which logic errors?

>>Time needed O(n)
Oh fuck you are right. My program is actually shit, because it moves the bitmask's bit over all 32 bits of an int.
Look at this implementation to see how I should have done it.
>staged extremely constructed problem
>The multiplier in my CPU grew on a tree.