Can we get one of these threads going?
all the kids will be at school though anon ;^)
>>46844495
1 < 2
>>46844495
What does this do?
>>46844714
every time
>>46844714
omfg i kek'd so hard
>>46844784
As soon as I saw 'import sys' I knew it was gonna be bad. Am I misunderstand the question or is the answer like two lines long?
total = 10 + 14
print total
>>46844794
Brian Wu is the fucking worst
>>46844840
>>46844784
>print total
showing the value wasnt in the spec bro.
>>46844784
But that's quite obviously trolling.
>>46844773
Write lobster to lobster.txt for ever.
>>46844794
Disgusting.
>>46844495
it's one of those things that the longer you think about, the funnier it gets
>>46844524
hehe I was in that thread, clearly remember that fag who thought his solution was superior to a simple if-else if. "muh code reuse! muh copy-paste code smell" he kept telling
>>46844495
I'm glad I did this in an online interpreter
>>46844776
if(userNumber & 1) Console.WriteLine("Odd");
else Console.WriteLine("Even");
Personal favorite
>>46845221
Does it work?
>>46844524
I thought that was just a demonstration of the power of scheme macros
>>46845235
It's a huge ass memory leak and buffer overflow target but I suppose it does
>>46845147
>using shitty unreadable tricks like that
you deserve to be unemployed forever
>>46845255
How would you make it overflow though?
>>46844849
I'm sure you'd promote the shit out of her games if that sexy beast slept with you!
>>46844495
This is great, thanks for the laugh
kek
>>46845263
>userNumber & 1
>unreadable
Do you even c?
>>46845266
A floating point number that's over 20 digits long (which I suppose isn't possible, but assuming that is never good)
>>46844784
>having to write "self" at the beginning of each method
Now I remember why I don't like python. That and the dynamic typing.
>>46845291
That's about four times more unreadable than num % 2 == 0. The C compiler optimizes it away anyways. Do YOU even C?
>>46845266
>>46845292
Nvm I thought %f did scientific notation. It is possible
>>46844524
I remember this thread.
Of course, my solution was better than everyone else's.
>>46845305
>That's about four times more unreadable than num % 2 == 0.
[citation needed}
>>46844894
>Write lobster to lobster.txt for ever.
You mean until it runs out of file descriptors because he didn't use close() or the with statement?
>>46845305
>>46845323
also not same anon
>>46845325
Lmao... didn't even notice that. I was focused on the lack of counter use in the while loop (or lack of breaks if the counter wasn't supposed to be used as the loop conditional).
>>46845291
Another guy here, let me explain why it is silly.
You want to know if an integer is an even number, divisibility by some other integer. Mod is exactly what you want, when you use & 1 of course you get the same result but you are mixing in binary with logic purely concerned with integers. It's silly. It also would break in case of something other than integers although that's a bit of stretch.
>>46844495
>>46844714
>>46844714
>>46844714
kek'd like a motherfucker.
>>46844524
i don't get it. seems okay
>>46845246
that's common lisp.
>>46845606
>i don't get it. seems okay
You don't spot the pattern?
>>46844495
Haha, I wrote this as a joke for a virus thread the other day. Thanks for the meme :^)
>>46844524
Whoever coded this has poor organization.
Or this language is just shit.
What do I know though, java is my favorite
>>46845345
Yes, because the stupid & 1 trick doesn't work on signed ints
>>46845294
You can use static typing if you want
>>46845625
is this the right pattern?def lettergrade(grade):
if grade<0:
return "error: negative grade"
grades = "FDCBA"
values = [.7,.0,-.3]
modifiers = "+ -"
for i in range(4,0,-1):
for j in range(len(values)):
if grade>=values[j]+i:
result = grades[i]+modifiers[j]
return result
print lettergrade(2.9)
tell me how I can ascend past cs meme level
>>46845294
Self self. Self self self? Self:self __self__ self = self.self(self)
_self = self.self?(self, self_)
self!
>>46845834
thats clever, I have never thought to use substrings like that
>>46845834
I like this solution a lot.
>>46845884
pfft nice try
>>46845784
>the stupid & 1 trick doesn't work on signed ints#include <stdio.h>
int main(void){
int a=3, b=4;
unsigned int x=5, y=6;
if( a & 1 )
puts("a is odd");
else
puts("a is even");
if( b & 1 )
puts("b is odd");
else
puts("b is even");
if( x & 1 )
puts("x is odd");
else
puts("x is even");
if( y & 1 )
puts("y is odd");
else
puts("y is even");
return 0;
}a is odd
b is even
x is odd
y is even
>>46845834
> grades = "FDCBA"
This is exactly the line of thinking you should have had, good jobbu.
>>46845887
lol what?
>>46845889
Umm, negative signed ints, you dumbass. Otherwise there's not really any point in them being signed
>>46845863
>>46845884
>>46845899
Thanks, guys I was honestly expecting /g/ to hate on the early return.
>>46845904
>negative signed ints, you dumbass
Oh I'm sorry, perhaps you'd like to stop blaming your inability to communicate clearly on other people?
>You're also still wrong#include <stdio.h>
int main(void){
int a=3, b=4;
unsigned int x=5, y=6;
int j=-1,k=-2;
if( a & 1 )
puts("a is odd");
else
puts("a is even");
if( b & 1 )
puts("b is odd");
else
puts("b is even");
if( x & 1 )
puts("x is odd");
else
puts("x is even");
if( y & 1 )
puts("y is odd");
else
puts("y is even");
if( j & 1 )
puts("j is odd");
else
puts("j is even");
if( k & 1 )
puts("k is odd");
else
puts("k is even");
return 0;
}a is odd
b is even
x is odd
y is even
j is odd
k is even
>>46845904
either wrong reply or he thought you were samefag
>>46845904
Am I being trolled?package main
import "fmt"
func main() {
var posEvenInt int32 = 10
var posOddInt int32 = 9
var negEvenInt int32 = -10
var negOddInt int32 = -9
var posEvenUint uint32 = 10
var posOddUint uint32 = 9
fmt.Println(posEvenInt & 1)
fmt.Println(posOddInt & 1)
fmt.Println(negEvenInt & 1)
fmt.Println(negOddInt & 1)
fmt.Println(posEvenUint & 1)
fmt.Println(posOddUint & 1)
}
0
1
0
1
0
1
The sign bit is the most significant bit, not the least significant bit.
>>46846020
That may be true but the LSB determines parity.
>>46846020
hey is this the case for little endian or big endian?
im trying to see if I remember this stuff from way back
>>46846106
>the LSB determines parity
Just stop it, you silly man.
>>46846133
Endianness is about byte ordering, not bit ordering.
>>46846106
yes, which is exactly why this trick works.
I just can't see what you're getting at here.
>>46846151
ah ok, thanks friend.
>>46845277
>sexy beast
at least a beast
>>46845235
Sure it does, if you want to inflate your program, literally.
>>46845277
>her
>>46846271
why is the file name brian_wu.jpg
what kind of last name is brian?
>>46846161
I wasn't getting at anything, I was clarifying for whoever I replied to. I just got here.
>>46846699
Last names are place last logically. Brian is the first name of the man depicted in the image.
>>46848019
placed last*
My grammar isn't terrible, I swear!
>>46844794
if (SJW){
ignore();
}
>>46846020
int is_even(int number){
return (number << 1) & 1;
};
if(isAMeme(meme)) {
while (YES) {
NSLog(@"Nice meme");
}
}
>>46845904
can you even two's compliment?
>>46844714
was about to let loose a sensible chuckle until I read
>>46844775
>>46845560
fuck man, /g/ keks?
>>46844495
That looks like a typo.
>>46848189
>true/false function
>doesn't return bool
Fuck you.
>>46848682
kek top
>>46848682
There's no bool in C pre-99. Although, the function is guaranteed to always return exactly one bit of information, which is isomorphic to the typical Boolean.
>>46844495
i don't get it
is there an addition on strings
>>46848870
the + operator concatenates strings together in Python
>>46844794if (tweeter == gamergater || !tweet)
printf("Block\n");
[\code]
>>46849058
compiler error: unexpected token "[" on line 003:[\code]
I still don't understand what anyone finds funny about these.
Can somebody explain it to me maybe?
How about these memes:
Rust is basically Haskell cleverly disguised as a C-style language so as to not scare away imperative programmers.
JavaScript is essentially Common Lisp with a C-like syntax.
Referential transparency means the references are transparent, like in Java.
In a functional language, you writebaz(bar(foo(n)))
In an imperative language, you have to writeint x = foo(n);
int y = bar(x);
int z = baz(y);
return y;
>>46844794
>=
for loop in normal languages:for(i=1, i<10, i=i+1)
do();
for loop in lisp:function f(i)
if(i==0)
do()
return
do()
f(i-1)
return
f(10)
lisp, not even once(once(once(once...
>>46850305
>>46850305
Common Lisp has loops. The loop macro includes a lot of loop structures. The do loop is almost exactly like C's for loop.
>>46850357
>680x445
triggered me
Haskell is the world's best imperative language but JavaScript is the world's best functional language.
>>46845451
counter var is used in this program. He's opening infinitely many files and writes lobster a single time into each.
>>46850305
printing in normal languages:print("Hello !");
printing in Java™ by Oracle®:Java.MilkyWay.SolarSystem.PlanetEarthX.System.SecurityManager.GenericObjectWrapper.BufferedObjectProxy.BufferedObjectStream.BufferedObjectOutputStreamWriterPrinter booswp = Java.MilkyWay.SolarSystem.PlanetEarthX.System.SecurityManager.GenericObjectWrapper.BufferedObjectProxy.BufferedObjectStream.BufferedObjectOutputStreamWriterPrinter.getInstance();
booswp.getClass().getMethodByName("print").invoke(booswp.getClass(), "Hello !");"
java, not even once.clone()
>>46850444
triples confirm
>>46844768#include <stdio.h>
int main(void){
int i, j, end;
scanf("%d", &end);
for ( i = 0; i < end ; ++i){
printf("\n");
for ( j = 0; j < end; ++j){
if (j == i || j == end - 1 - i)
printf("*");
else
printf(" ");
}
}
printf("\n");
return 0;
}
just for fun ofc
>>46850956a = int(input("Give in a number: "))
for x in range (0, a):
for y in range (0, a):
if (y is x) or (y is a - (x + 1)):
print('*', end='')
else:
print(' ', end='')
if x is not a - 1:
print('')
le python
Extrapolating from current language evolution I predict that in 20 years time programmers will be using . . . Lisp. Except it won't be called Lisp and it might have a different syntax, but it will offer all the power and flexibility of the world's second oldest programming language. Now that's progress!
>>46851057
You know a lot of these fat asses in fedoras would probably be considered hot if they dressed the same but wasn't fat.
I knew one guy who actually was a fat fedora wearing type (he literally wore fedoras and dressed in suits). He got more pussy than I ever did.
>>46853503if (e <= 1 && e >= 9)
return e;
else
return "NaN";
>>46853589
What about floats?
>>46853631
it returns NaN.
>>46853642
Oh, i just re-read the statement. my bad
>>46845904
>being this illiterate
>>46853589
Shouldn't it be (e >= 1 && e <= 9)?
>>46844894
well, there'll be "lobster0.txt" and "lobster1.txt", etc. each containing the word "Lobster."
>>46844840
It just asks you to assign 24 to a variable.
>>46844714
It doesn't even return the value
Do you guy think this deserves one of this dank memes?
from sys import argv
filename = argv[1]
res = 0
num_lines = sum(1 for line in open(filename)) #This counts lines in a file
with open(filename) as f: #this tells the program to open that file and name it "f"
for x in range(1, num_lines+1): #for the amounts of lines, do the following
h = [int(x) for x in f.readline().split()]
#this converts the element on the line into a string
res = int(x) + res
#the sum
print res
>>46844524
people mad they can't read lisp macros
>>46850357
>bait in 1080p
>image is 800p
Holly fuck your stupid fuuuuuuck
>>46853045
If that's Java, then it's probably only there to meet an abstract method specification, so that the compiler doesn't complain.
>>46844794
It's like the first if statement xe's ever written.
It would be perfect if it was two separate statements.
I found this while grading some homeworks (TA)
>>46854196
>800p
it's clearly 445p
>>46849096
kek'd
>>46844714
Can someone explain?
>>46855593
Yes, someone can.
>>46855593
It waits a day and gets the current date
>>46855593
It waits a day and then gets the current date, which is stupid in and of itself.
There's no return though. The function just ends up waiting for no reason.
>current CS major
>worried I'll end up like this
How do I not be a total failure at this?
I plan to read a few extra books on C++ in addition to the courses I'm taking and move on to other languages after
Is it just a matter of actually learning and practicing?
>>46850357
>>46854196
>>46855428
>1080p
>800p
>445p
It's a static image, would there actually be any progressive scan?
>>46856032
just be a logical thinker and don't be an idiot
>>46856032
It just takes experience. There's no great shortcut.
>>46845859
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
>>46855149
Love it.
>>46856032
If you actually stick to the reading then you could be great. Courses only really introduce material.
>>46844768
I remember that thread. I'm terrible at programming and I shit out some python that did that in a few minutes.
>>46849314
but it's mostly all true
>>46854862
that isn't exactly reassuring either
have it return 0 or something so you know it's not actually implemented
>>46845147
>if(userNumber & 1) Console.WriteLine("Odd");
>else Console.WriteLine("Even");
Console.WriteLine(userNumber%2 == 0 ? "Even" : "Odd");
>>46845221
This is the best combination of stupid and clever.
>>46850747
>look guys, I can insult java too!
Next time, try an example that is actually convoluted in java, but simple in the programming language you are trying to compare it to.
>>46857688
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
>>46844776
>not knowing what a modulo is
b8/10