[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 40
File: trig.gif (3 MB, 961x491) Image search: [Google]
trig.gif
3 MB, 961x491
tornado remembrance edition
>>
>>52351785
IT WASN'T EVEN ON THE TENTH PAGE

MODS
>>52346599
>>
Did you add some sleep functions there?
Why is your tornado so fucking slow?
>>
File: xdress.png (1 MB, 1702x2471) Image search: [Google]
xdress.png
1 MB, 1702x2471
>>>52351782
How is Rust associated with SJWs?
>>
F# is a meme.
>>
>>52351821
because of sleep
>>
>>52351822
It's made by Mozilla
>>
>>52351827

What about OCaml?
>>
>>52351844
Genuinely good.
>>
>>52351844
It's legit. It's a fantastic language.
>>
File: Capture2.png (25 KB, 329x305) Image search: [Google]
Capture2.png
25 KB, 329x305
still looking for a solution for proportional typeface

made some sight progress
def aproxWidth(st):
size = 0
for s in st:
if s in 'lij|\' ': size += 37
elif s in '![]fI.,:;/\\t': size += 50
elif s in '`-(){}r"': size += 60
elif s in '*^zcsJkvxy': size += 85
elif s in 'aebdhnopqug#$L+<>=?_~FZT' + string.digits: size += 95
elif s in 'BSPEAKVXY&UwNRCHD': size += 112
elif s in 'QGOMm%W@': size += 135
else: size += 50
return size * 6 / 1000.0
>>
>>52351844
obviously

how do you even have to ask that question
>>
Where does this "you need to know advanced math to understand SICP" meme come from?

It's high school math at most.
>>
>>52351822
CoC
>if you say anything non-SJW in any social media, no matter how removed from the project, you are no longer allowed to participate in any rust community
>>
>>52351844
The memest
>>
>>52351785
You should make it turn at random times to make it look like it's alive.
>>
>>52351865
The problems are kind of hard and require you to think.
Retarded people just associate problem solving with math.
They can then claim that they are just bad at math and not actually retarded.
>>
>>52351865
They're probably talking about discrete math

If you've already been programming for a while, it's mostly the same skill set
>>
File: 1451553795827.jpg (21 KB, 500x500) Image search: [Google]
1451553795827.jpg
21 KB, 500x500
>>52351865
>>52351908

>programming is not math
>>
File: SICP.jpg (194 KB, 931x1398) Image search: [Google]
SICP.jpg
194 KB, 931x1398
About to delve into pic related.

What should I expect?
>>
>>52351924
Programming is never, has never been and will never be math. Get butthurt, pajeesh.
>>
>>52351934
To achieve satori.
>>
>>52351934
math on a higher level than the triple integral
>>
>>52351924
Technically it's not math

Though you're fucking retarded if you're not using math when programming.
>>
>>52351785
Sauce!
>>
>>52351965
You are genuine idiot.
>>
>>52352048
What math do you need to write unit tests, pajeet?
>>
>>52351858
so you're looking to do what, exactly?

make ascii art in variable width fonts for meme spewing?
>>
I would think Ranjeep would be the one saying programming isn't math, not the other way around
>>
>>52352087
DEDICATED
>>
File: 1452407561369.jpg (380 KB, 980x1196) Image search: [Google]
1452407561369.jpg
380 KB, 980x1196
>>52351934
Don't fall for the meme, anon.

A book that compares programming to wizardry belongs in the bin.
>>
>>52352100
precisely
>>
>>52352107
GRAPHICS
>>
>>52352078
think it's python m8
>>
>>52352122
STREET
>>
>>52352122

I'D JUST LIKE TO INTERJECT FOR A MOMENT...
>>
what are you nerds arguing about

math and programming are two separate things. you can use them together, and often do, but they are not one in the same.
>>
>>52352142
OF
>>
>>52352114
>bin
What the fuck is a bin?
>>
>sicp exercises
I'm never going to be a good programmer
>>
>>52352220
maybe watching the lectures could help, they're widely available on youtube
>>
>>52352191
short binary/binaries
>>
>>52352248
>my attention span
I'm never going to be a good programmer
>>
>>52352191
jog on yank
>>
>>52352191
fuck off you fat cunt
>>
>>52352191
FOY
>>
>>52352146
>this queer
pick up a book will ya
>>
>>52352191
FOY
>>
>>52352191
a place to chuck big fat yank bastards
>>
>>52352078
tornado text + sine wave offset
>>
>>52351827
>>52351717
>>
>>52352191
mv ./structure_and_interpretation_of_computer_programs /bin/
>>
>>52352191
u pullin me leg ther chum?
>>
>>52352191
- /bin, a common Unix directory
- bin(), a function in Python that converts an integer into a binary number
- .bin, a filename extension for binary files
- .bin, a CD disk image file format
>>
>>52351827
E flat > F sharp
>>
>>52352191
u 'avin a giggle m8?
'aven't u heard of a bin lorry?
>>
>>52352395
u fuhgo' the bin wer we chuk fat yank basterds amirite lads?
>>
>>52352407
Sharps >>>>>>>>>>>>>>>>>>>> flats
>>
File: 61yUkEfElYL._UX250_.jpg (18 KB, 250x376) Image search: [Google]
61yUkEfElYL._UX250_.jpg
18 KB, 250x376
This is the author of Cracking the Coding Interview

She's pretty qt
>>
>>52352444
I'd crack her code

if you guys understand where I'm getting at
>>
void cleanup()
{
free_memory_used_by(things);
free_memory_used_by(window);
}

int main(int argc, char* argv)
{
...

cleanup();

return 0;
}


Or

int main(int argc, char* argv)
{
...

/* cleanup */
free_memory_used_by(things);
free_memory_used_by(window);

return 0;
}


and why?
>>
>>52352444
N O G F
O
G
F
>>
>>52352474
like bags of memes
>>
File: laughin_anime_girl.gif (134 KB, 340x340) Image search: [Google]
laughin_anime_girl.gif
134 KB, 340x340
>>52351965
>he doesn't use a type system based directly off of mathematical theories
>>
>>52352435
sharps are for fucking retards

flat master race
>>
ORIGINAL PIRATE MATERIAL
>>
File: 1452437195842.png (643 KB, 1068x1089) Image search: [Google]
1452437195842.png
643 KB, 1068x1089
>>52352474
I deleted that image, I thought it might have been a bit too lewd for /dpt/.
>>
>>52352459
first

everyone does it that way
>>
>>52352505
I love type theory
data Nat : Type where
Zero : Nat
Succ : Nat -> Nat

double : Nat -> Nat
double Zero = Zero
double (Succ m) = Succ . Succ $ double m


Nat : Type
Nat = (i : Fin 2) & case i of {
0 => Fin 1;
1 => rec Nat
}

double : Nat -> Nat
double = \v0 -> let v0i, v0x = v0 in case v0i of {
0 => 0, case v0x of {0 => 0};
1 => 1, let m = v0x in store (1, store (double (load m)))
}
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [Google]
1451751832808.png
17 KB, 418x359
>>52352505
>he does
>>
>>52352505
Using a calculator is not programming, despite a calculator being made through programming.
>>
>>52352119
I'd imagine this is doomed from the start, considering the width varies from font to font, so there's no guarantee that your meme spewing will be the same on everybody's computers, especially on /g/ where we're all special snowflakes and so naturally all have different fonts on our web browsers.

Also, correct me if I'm wrong, but I'm under the impression that character width doesn't change uniformly with text size (so a 12 point j and a 16 point j may have a different difference in width than a 12 and 16 point w, for example)

The other issue is a lot of fonts don't work for this, mathematically speaking. For example, if I is three pixels wide, and W is 25 or whatever, and your spacer is 10 pixels wide, there's no way to get I and W to be the same length, as W will always be at least two pixels wider than I with spacers. You might be able to get it to line up pretty well, and there might be a font where it turns out perfect, but I'm pretty sure you can't do it using only one or two spacer characters in times new roman, at least.

The best way I can think of to attempt it in python is using dictionaries, at least that way you can loop.
>>
File: memeguy.png (96 KB, 262x259) Image search: [Google]
memeguy.png
96 KB, 262x259
>spent time programming the past 4 years of hs instead of studying
>somewhat fucked up my grades the past 2 years
>3 days left to apply for college
>personal statement neither started nor promising, referee still not replied
>will probably get rejected by everyone anyway
I'm applying for an engi degree mildly related to programming(mainly cfd) but which is of main interest to me
If I fail I assume that road is shut and closed for me, so only remaining thing going on for me is programming, but I want to avoid CS like the plague
is it possible, without a cs degree, but with a say portfolio, to get anywhere interesting like for example in systems programming
all I want is to avoid the youth circle jerks and super corporate/business/entrepreneurial/startup oriented bullshit
or should I bite the bullet and go with CS if I fail my main target

thx for reading my blog
I've always appreciated your support dpt
>>
File: 1452369306056.jpg (33 KB, 600x564) Image search: [Google]
1452369306056.jpg
33 KB, 600x564
>>52352532
I swear to fucking god, anon. If you frog post once more.
>>
>>52352459
int main(int argc, char* argv)
{
atexit(cleanup);
...
return 0;
}
>>
>>52352544
i was thinking let the user set the font. maybe if i use some text to image thing that supports most fonts i could calculate the width of characters depending on font
>>
>>52352541
if the calculator involved both writing proofs and writing code then it would be math and programming
>>
>>52352530
Of course, the bottom can be optimized a fair bit right off the bat
double = \v0 => let v0i, v0x = v0 in case v0i of {
0 => 0, v0x;
1 => 1, store (1, mutate double v0x)
}
>>
File: 1451754656606.png (17 KB, 418x359) Image search: [Google]
1451754656606.png
17 KB, 418x359
>>52352551
>>
>>52351785
now do it with c++
>>
>>52352577
GNO.
>>
File: 1452413066290.png (139 KB, 400x398) Image search: [Google]
1452413066290.png
139 KB, 400x398
>he says JavaScript is shit but he has never used it
>>
>>52352577
>both writing proofs and writing code
Same thing innit
>>
>>52352594
now do it with x86

>am i fitting in yet
>>
>>52352547
this something I've concentrated on for the past 7 months: https://github.com/cogloch/Flysmith
am I worthy of anything or should I just kill myself?
>>
>>52352598
>he says javascript is good
L O L
O O !
L ! L
>>
Any chance someone could have me would my Xcode problem?
http://stackoverflow.com/questions/34499600/how-do-i-get-a-function-class-definition-from-a-cpp-by-including-its-correspond/34709943#34709943
>>
Why hasn't /g/ written an Introductory programming book yet?
>>
>>52352580
>>52352530
is your language going to require the { ; } anywhere or is that just a stylistic choice to distinguish different parts of the language?
>>
>>52352618
get a better readme
>>
>>52352594
How is that any harder?
>>
File: 1452351060385.jpg (36 KB, 500x211) Image search: [Google]
1452351060385.jpg
36 KB, 500x211
Well, I think I've learnt enough JS for now.

What language should I move onto next?

I was thinking PHP.
>>
>>52352641
I'm too smart for that
>>
>>52352646
Like Haskell or Agda or anything similar, you can use it to escape significant whitespace.

I prefer to use it all the time when writing intermediate code out, dunno why.
>>
>>52352598
>he says cancer is shit but he has never had it
>>
>>52352547
Good caricature, I like it. Saved.
>>
>>52352641
We'd be too busy arguing what language would be best
>>
>>52352692
>introductory
python would be best
>inb4 bad practices
>>
>>52352660
fuck's sake just make it consistent

have semicolons or don't have them
>>
File: 1452448056047.png (924 KB, 1241x1754) Image search: [Google]
1452448056047.png
924 KB, 1241x1754
Press F12, go to console and paste this in:

document.querySelector("form").childNodes[2].value


Post results.
>>
>>52352576
You still run into the issue of there being no solution for
a+c*n_1 = b+c*n_2
where a is the width of character 1, b is the width of character 2 and c is the width of your spacer

for a lot of characters. I mean you could manually edit this, but that's kinda cheating.
>>
>>52352630
Shit, i meant this:
http://stackoverflow.com/questions/34709920/how-do-i-link-cpp-files-to-hpp-files-in-xcode-that-were-made-outside-of-the-pr
>>
>>52352712
I don't see any reason to, and this method seems to be pretty tried-and-true.
case x of
0 => foo
1 => bar

and
case x of {
0 => foo;
1 => bar
}

are entirely equivalent, but the second could be written like
case x of {0 => foo; 1 => bar}

or any other way you like.

It's a nice compromise.
>>
>>52352662
apples and oranges anon

Pick a language you know and love. 10 different anons will shit on it or praise it for their own reasons. Doesn't mean shit, just try it and form your own opinion.
>>
how do i fizzbuzz in c++?
>>
>>52352736
yeah i get what you mean, nobody wants to do this by hand
>>
>>52352728
Not suspicious at all.
>>
>>52352758
no idea chum, but here's brainfuck:
 >++++++++++[<++++++++++>-]<[>+>[-]>++++++++++[<++++++++++>-]<+<<[->>->+<<<]>>>
[-<<<+>>>]<>>+++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<+>]+>[-]>[<<->>[-]]>[-]
<<<[[-]++++++++++[>++++++++++<-]>++.+++.[-]<[-]+++++++++++[>+++++++++++<-]>+..
[-]<[-]<<[-]>>]<>>+++++<<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<+>]+>[-]>[<<->>[
-]]>[-]<<<[[-]+++++++++[>+++++++++++<-]>-.[-]<[-]+++++++++[>+++++++++++++<-]>.
+++++..[-]<[-]<<[-]>>]<<[[-]>>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]>>[
>++++++++[<++++++>-]<.[-]]<>++++++++[<++++++>-]<.[-]<<<]>[-]++++++++++.[-]<[-]
<-]
>>
>>52352758
modulo
>>
>>52352754
javascript, php and python are objectively shit. countless experts agree.
>>
>>52352782
example pls
>>
>>52352799
int main() {
cout << "fizzbuzz";
}
>>
>>52352787
Try them and form your own opinion.

Or do you trust the experts who say that c and java are shit too?
>>
Hey guys, i suck at c. How do i convert a decimal number to binary using arrays?
>>
>>52352728
_bTmhn4gy9TMNgBLUikcY2RfJOyFjGA65

wtf is this
>>
>>52352787
lmao countless experts say c is shit
>>
>>52352831
ur fucked lmao
>>
>>52352830
switch to c++
>>52352799
if (array[i] % 3 == 0)
{cout << "Fizz";}
>>
>>52352833
>lmao countless experts say c is shit
>experts
>>
>>52352831
kek you're fucked
>>
>>52352517
Flat are for singers
Singers are often musically meh
>>
>>52352799
#include <iostream>

int main()
{
for(int i = 1; i <= 100; ++i) {
if(i & 3 == 0 && i % 5 == 0) {
std::cout << "fizzbuzz";
}
else if(i % 3 == 0) {
std::cout << "fizz";
}
else if(i % 5 == 0) {
std::cout << "buzz";
}
else {
std::cout << i;
}

std::cout << std::endl;
}
}
>>
>>52352831
you fell for it retard
>>
File: fizzbuzz of the christ.png (402 KB, 1024x768) Image search: [Google]
fizzbuzz of the christ.png
402 KB, 1024x768
>>52352868
JC would never approve of something so verbose
>>
>>52352728
post password?
>>
File: file.png (29 KB, 677x342) Image search: [Google]
file.png
29 KB, 677x342
Anyone have any clue what i'm fucking up on? It's not giving me a .exe file. I'm using w7 and minGW.
>>
>>52352868
ow the edge

    for(int i=1; i<101; i++){
if (i%3!=0 and i%5!=0) cout << i;
if(i%3==0) cout << "Fizz";
if (i%5==0) cout << "Buzz";
cout << '\n';
}
>>
>>52352878
kill yourself

it's not even verbose retard kill yourself
>>
>>52352758
You can't, it's impossible.
>>
>>52352831
document.querySelector("form").childNodes[2]

<input type="hidden" name="pwd" id="postPassword" value="kek">
>>
>>52352692
Nah, we already decided that's OCaml.
>>
>>52352864
uu wwoott
>>
>>52352894
>and
>>
>>52352773
I didn't mean do it by hand, I meant use an edited font file that is "times new roman, but not really" so that you can have nice character widths for your spacer character. but at that point you might as well just download a monospace version of your font.

I know there are a lot of monospace versions of fonts out there, for example I use a monospace comic sans for IDLE
>>
Tried to feel the difference between folds and
 foldl (+) 0 [1..]
almost blew my system up. I really thought there would be a limit like there is for foldr...
>>
>>52352851
>>52352858
>>52352876
It doesn't even let me delete his post, it says password incorrect.

I'm using his password now:

_bTmhn4gy9TMNgBLUikcY2RfJOyFjGA65

Someone see if they can delete my post.
>>
>>52352901
>it's not even verbose
lmao c++ cucks believe this
>>
>>52352749
OCaml doesn't have significant whitespace and yet doesn't have that issue.
>>
>>52352916
and works faggot
>>
File: hax.png (8 KB, 734x72) Image search: [Google]
hax.png
8 KB, 734x72
am i hax yet?
>>
>>52352923
you got trolled m8
>>
>>52352089
assertEqual(1, 2)
>>
>>52352894
>>>52352868
looks a lot better

i bet you think python looks good because it isn't as """"""""verbose"""""""" lmfao kill yourself
>>
>>52352923
u got double crossed lmao
>>
>>52352547
my experience is not going to be encouraging. I've been programming since I was 12 so I have a lot of experience and I took my a levels early so I had what I thought was a decent CV.

Unfortunately no matter how many places I sent it off to I didn't get any response so I applied for uni. Since starting uni I've had an internship and a part time job programming.
>>
>>52352926
punctuation, whitespace, namespace specifiers, proper for loop syntax isn't verbose you fucking shitkid

it's like you think a comic book is better than a textbook because it isn't as verbose
>>
File: w398fav.gif (2 MB, 333x194) Image search: [Google]
w398fav.gif
2 MB, 333x194
>>52352087
Holy shit
>>
>>52352963
>he thinks I was considering those
lmao it's still verbose
>>
>>52352972
no it isn't it's a standard fucking fizzbuzz

one in python would look similar
>>
>>52352928
many structures which are used in Haskell-like languages require significant whitespace, and it can help clean up syntax in some places. things like the do syntax are gonna have it anyways unless you want to write out huge ugly blocks of code everywhere, so there's no reason not to include it in other parts of the language.
>>
>>52352928
I'm not really a fan of how ML does their syntax. There's no compromise there -- sure, whitespace isn't significant, but you have to have the boilerplate symbols all the time.
>>
>>52352985
It's standard if you are a babby

and in python, the following works
for i in range(1, 101): print "FizzBuzz"[i*i%3*4:8--i**4%5] or i
>>
>>52352929
Anon is right ... "and" does actually work. I never knew.
>>
>>52352551
>>52352583
Shit, this shouldn't have made me laugh so hard
>>
>>52353008
fucking retard kill yourself

no one wants obfuscated code in a real program

it's not even as efficient that the standard fizzbuzz and it's all in one long ass line

you'd fail the interview with that fizzbuzz
>>
>>52353018
Whoops, I meant "password" without the fullstop.
>>
File: 1451779320598.png (20 KB, 418x359) Image search: [Google]
1451779320598.png
20 KB, 418x359
>>52353037
>that
>obfuscated
>me
>fail interviews
>>
what's a good snack to obscenely munch while programming

off to the shops in a bit and I'm probably going to be up all night
>>
>>52353051
dicks
>>
>>52353051
chicken tendies tbqf
>>
>>52352444
She's a 6/10 milf, so basically 4/10.
>>
>>52353045
>he is this smug about writing "fizzbuzz of the christ"
>>
File: IMG-20160105-WA0021.jpg (61 KB, 480x854) Image search: [Google]
IMG-20160105-WA0021.jpg
61 KB, 480x854
Working on the sunshine app for Udacity's android course.

How do i go about having a separate class that provides the user current location using Google play services. That way I can call it from the fragment's async task like LocationService.getUserCurrentLocation()

Can't seem to figure it out since I need to pass the context in order to configure the googleapiclient and passing the activity's context and trying to cast it from the service throws me an exception.
>>
>>52353018
I don't see a password cookie to edit.
>>
File: 1452270251666.png (141 KB, 439x290) Image search: [Google]
1452270251666.png
141 KB, 439x290
>>52353080
>he isn't
>>
>>52353076
STILL BEATS NOGF ;_;

;_;
>>
>>52352758
see>>52352894
>>
>>52353051
bbq chips
>>
>>52352831
I got
_vXjniGgeRB1StArDZSb8jKekd5m81ijV
>>
>>52352929
it's deprecated shit that doesn't belong in code written in 2016
>>
>>52353151
>Error: Password incorrect.
>>
>>52353051
usually i go with some kind of potato chips but then my fingers get greasy so i need to be able to wipe them off every time i type some shit. i also like flaming hot cheetos but then my fingers get gross as fuck and i just start typing with one hand and eating with the other
>>
>>52353051

chopped pineapple
>>
>>52352888
pls respond i've been working on this for almost 2 days now
>>
>>52353172
trolololo
>>
>>52353051
>>52353179
don't eat any kind of messy shit at the computer it's disgusting

go and eat and then come back

regular food eaten with utensils is fine at the computer
>>
File: visual-studio-2013-03-700x503.jpg (105 KB, 700x503) Image search: [Google]
visual-studio-2013-03-700x503.jpg
105 KB, 700x503
>>52352926
That ain't really verbose doe. Verbose is like pic related.
>>
>>52353179
>>52353149
crisps are out of the question. can't handle grease on my keyboard.

I'm thinking chocolate peanuts would go down a treat especially since I drink a lot of coffee

>>52353182
that's not a thing

>>52353065
that's a gimmick
>>
>>52352888
don't you need to specify more parameters?
>>
>>52353091
Either you're fucking with me or that actually worked.
>>
>>52353201
Post your genuine password, anon. I just want to see if it's possible for me to delete your post.

All I can do with it is delete your posts.
>>
>>52353208
it's verbose for a fizzbuzz in c++
>>
>>52353198
check your user directory, it's probably putting the output there
>>
>>52353204
>eaten with utensils
then you fucking drop crumbs into the keyboard dumbass
>>52353211
one time i had some chocolate peanuts and i was snacking on them while working on something and it ended up being a few hours so i ate like 100 or so and then i had diarrhea for the rest of the week. idk if it's just me but i can't eat a lot of peanuts without that happening i guess
>>
>>52353234
no it isn't, it's completely standard

just because you compact the formatting and fuck up the readability like it >>52352894 doesn't make it better
>>
>>52353091
Kek, you actually did it, anon.

The passwords aren't a meme after all.
>>
>>52352922
foldr and foldl basically apply the + operator from different directions.
foldr will be from the right while foldl will be from the left.
foldr
1 + (2 + (3 + (... + 0)))


foldl
(0 + 1) + 2) + 3) + ...)
>>
File: maxresdefault.jpg (102 KB, 1280x720) Image search: [Google]
maxresdefault.jpg
102 KB, 1280x720
>>52353234
Well, that is true. I just googled fizzbuzz c++ and pic related.
>>
>>52353271
your idea of a standard is the inefficient entry-level implementation

I didn't compact the code, I'm guessing that's why you were coming at me with the whitespace, etc post before
>>
>>52353251
nah, I can eat what I want without problems. I habitually eat so little during the day that anything I snack on is digested without a problem.
>>
>>52353251
>then you fucking drop crumbs into the keyboard dumbass
no you have the plate on the desk and your keyboard placed further into the desk

what kind of food do you eat anyway that drops crumbs when you eat it
>>
>>52352728
> document.querySelector("form").childNodes[2]
<input type="hidden" name="pwd" id="postPassword">

Totally not at all suspicious ...
>>
>>52351924
faggot CRUD monkeys can make a website with 0 knowledge now.
>>
>>52353298
you're late
>>
File: file.png (34 KB, 677x342) Image search: [Google]
file.png
34 KB, 677x342
>>52353222
Not really, I can do this to change the filename of the exe from a to test though.

>>52353237
Holy crap you're right i'm a fucking dumbass. Thanks a bunch. Now i'm back to the problem I had yesterday. If I run the .exe it doesn't bring up a console, but it does open a process in my task manager that is open in SYSTEM so I can't stop it. Any idea what's wrong?

I did everything i've done on this (my main pc) on a another pc I have around and everything worked, so I don't know what is different on this pc to cause this.
>>
>>52353298
It's just for fun. All I can do with it is delete your recent posts.
>>
>>52353271
I bet you write comments every other line.
>>
>>52353289
kill yourself

you should always use braces and newlines

and yours isn't more efficient because you print twice on "FizzBuzz" (I/O is by far the heaviest operation)

if you cared about efficiency you'd bake the newlines like "Fizz\n"

fuck's sake
>>
>>52353304
sorry, is there a problem with CRUD interfaces? Even for desktop applications it makes sense.
>>
>>52353266
>Password Incorrect
smdh
>>
File: mount stupid.jpg (23 KB, 600x338) Image search: [Google]
mount stupid.jpg
23 KB, 600x338
>>52353331
kill yourself newfag

you don't know what you're talking about
>>
>>52353324
try adding a
system ("PAUSE");

before you return statement in the main function
>>
>>52353337
>and yours isn't more efficient because you print twice on "FizzBuzz" (I/O is by far the heaviest operation)
Wow you are retarded

>you should always use braces and newlines
Didn't deny that, I criticized your implementation
>>
>>52351827
D-F#-C => D-G-B
>>
>>52353366
k tard

it's 100% the standard fizzbuzz
>>
>>52353285
Yeah, from that it makes sense, but everyone seems to recommend using foldr which is counter-intuitive. Still trying to get used to the laziness I guess.
>>
["fizzbuzz" if x%15==0 else "fizz" if x%3==0 else "buzz" if x%5==0 else x for x in range(1,101)]


How do I run the print function on every element in a nice one-line fashion?
>>
File: 62407182.jpg (115 KB, 400x400) Image search: [Google]
62407182.jpg
115 KB, 400x400
>>52353355
Being this much buttmad you start attacking trolls.
>>
>>52353350
Opened incognito window and ran that code
got
>"_urLNxDpurToZkyHOjCbf6u5DRlIvsm7v"
Then tried to delete the "_3ms 7vpTaeD RuvhJ XE1fuevjve5 sz45W2" post and it worked
I don't know what that code is but it doesn't seem to be related to post deleting
>>
File: le real human bean.jpg (20 KB, 703x393) Image search: [Google]
le real human bean.jpg
20 KB, 703x393
>>52352191
It's like you're not even Anglo master race.
>>
>>52353399
one liners aren't cool outside of code golfing
>>
>>52353381
>D-F#-C
I like me some diminished sevenths
>>
>>52353389
I'm sorry about your inability to read. Like I said, I didn't compact your post. I didn't deny the standard, just said it's the entry-level implementation. No need to be so rustled about being entry-level
>>
File: file.png (15 KB, 428x236) Image search: [Google]
file.png
15 KB, 428x236
>>52353365
Didn't change anything. However I did notice that it still appears to be loading (when I bring up my user folder my mouse icon changes to the loading icon).

This is the code after adding the system("pause");
Maybe I fucked up here? I'm really new to this.
>>
File: LOL-I-TROLL-YOU.png (87 KB, 755x1255) Image search: [Google]
LOL-I-TROLL-YOU.png
87 KB, 755x1255
>>52353417
epic

what a great use of your time
>>
>>52353399
print " ".join([...])
>>
>>52352868
If you put the elses on the same lines as the closing braces, it would look a bit better.
>>
>>52352459
#define cleanup() free_memory_used_by(things); free_memory_used_by(window)

int main(int argc, char *argv[])
{
...

cleanup();

return 0;
}
>>
>>52352888
it will place it in a file named a.out or a.exe
you can specify a name with -o
g++ desktop\test.cpp -o desktop\IAMAFAGGOT.EXE
>>
>>52353459
thank you anon
>>
>>52353431
it's not "entry-level", it's a perfectly sensible implementation. it's fucking smug newfags that think they're so clever for writing shit like "fizzbuzz of the christ" which is not better whatsoever.
>>
>>52353474
Yeah it's sensible, but it's still entry-level.
>>
>>52352598
I'm a girl
>>
HEY GUYS, I SUCK, HOW DO I CHECK IF THERE ARE ELEMENTS WITH THE SAME VALUE BETWEEN 2 ARRAYS IN C?
>>
>>52353462
i like having a bit of fresh air

this isn't python you can afford to have some whitespace

a lot of people use the "cuddled else" like you suggest but having the else on the next line is also a valid style
>>
>>52352913
There is a significant trend in western music of XVII, XVIII and XIX century to write vocal music in tonalities (does this word exist?) with a lot of flat notes (sorry I don't know the exact English terminology), and it happens that most of the singers I meet are musically mediocre. Hence my post.
>>
>>52352987
It is better to have extra syntax in exceptional situations (effect-full computations in a functional language) than to have it everywhere.
There is no need for the symbols outside effect-full computations in an ML language as shown by the likes of OCaml.

>>52352991
Best syntax is lisp syntax. It's 100% consistent everywhere, trivially parseable, and infinitely malleable.
>>
>>52353421
It is, the way they have it set up on the backend, I think, is like this:

First it checks your IP, if your IP matches, it deletes your post, if the IP doesn't match it checks your post password.

An anon deleted my post before.

I've set my password to "password" if someone wants to test again.
>>
>>52353481
go ahead and show us your turing award-winning best-selling expert-grade enterprise fizzbuzz
>>
>>52353504
nested loops
>>
>>52353520
>100%
What about special forms?
>>
File: IMAG0284.jpg (1 MB, 1520x2688) Image search: [Google]
IMAG0284.jpg
1 MB, 1520x2688
>>52353458
Ur still a goober
>>
>>52353504
size_t i, j;
for (i = 0; i < len_a; ++i)
for (j = 0; j < len_b; ++j)
if (a[i] == b[j])
/* do something */
>>
>>52353547
i'm right in the middle of your shit so what the fuck? nice outfit goober
>>
>>52353538
Special forms are completely consistent, but macros can introduce inconsistencies, it's true. For instance, the meaning of (for x from 0 to 10 do (1+ x)) differs from using unquoted symbols that aren't bound and which value doesn't matter while the name does.
>>
>>52353507
wot? you can have whitespace in python too

but I agree with him, it looks nicer cuddled
>>
>>52353574
python shitters usually write horrible looking code with minimal whitespace
>>
>>52353527
do your own homework lmao
>>
>>52353395
> everyone seems to recommend using foldr which is counter-intuitive.
foldr is only strict if the function itself is strict, so you can use foldr on infinite lists. Also, if you only end up using part of the result, it will only evaluate as much as it needs to.

Also, foldl and foldr produce different results if the function isn't commutative.
>>
>>52352894
>i%3!=0 and i%5!=0
 i%3 + i%5 != 0
>>
>>52353593
kill yourself retard

>here is a perfectly sensible fizzbuzz
>it's entry-level. goml
>let's see you do better
>do your own homework lmao
>>
>>52353592
that has nothing to do with python, and more to do with user tendencies across any language. If you base it off /dpt/ where we like trying to write short code so it fits better on a screen, off course you're going to see it more
>>
>>52353570
Thank you goober, I just came out of the shower.
>>
>>52353618
is it still december in here?
>>
>>52353620
seriously, do your own homework. Don't use "sensible" as some defense against the original claim about it being verbose since the 2 aren't related
>>
File: 3a0.gif (522 KB, 200x200) Image search: [Google]
3a0.gif
522 KB, 200x200
>>52353618
>exact same results
>>
>>52353599
> so you can use foldr on infinite lists.
If foldr folds from the right, how does it reach the "end" of an infinite list to start the fold? That's one thing that was really bothering me.
>>
>>52353641
kill

you're

self
>>
>>52353599
What about foldl'?
>>
>>52353464
Is this a troll? Because I seriously hope no-one is dumb enough to do that in real code.

First rule of macros: don't use macros unless you absolutely positively definitely have no alternative.
>>
>>52353658
rustled as fuck lmao
>>
>>52353520
nested matches don't work out to well. but the bigger thing is that there's no way to do things like inline type annotations in OCaml's syntax. i tried to think up some ways to do it for my own language (although i still have barely even started on it) and the best i could come up with was:
val f : Int -> Int where
let f = (+) 1

but it's still a lot more verbose than using significant whitespace.
and while i do like Lisp syntax for a lot of things, i don't think it fits everywhere. trying to fit the semantics of a strongly typed language into it comfortably is difficult on its own, but a big language like Haskell is just too much work
>>
File: 1452367796069.png (1 MB, 1831x1337) Image search: [Google]
1452367796069.png
1 MB, 1831x1337
Press F12, go to console, paste this in:
String.prototype.reverse = function() {
var val = "";

for(var i = 1; i <= this.length; i++) {
val += this[this.length - i];
}

return val;
};

var star = function(str) {
var val = "\n";

if(str.length <= 2) {
throw "MemeError: The string length of \"" + str + "\" is too small, you retard.";
}

for(var i = 0; i < str.length - 1; i++){
val += (" ".repeat(i) + ( str[i] + " ".repeat(str.length - (2 + i)) ).repeat(2) + str[i] + "\n");
}

val += str + str.substring(0, str.length - 1).reverse() + "\n";

for(var i = 2; i <= str.length; i++){
val += (" ".repeat(str.length - i) + ( str[str.length - i] + " ".repeat(i - 2)).repeat(2) + str[str.length - i] + "\n");
}

return val;
}

star(document.querySelector("form").childNodes[2].value);


Post results.
>>
>>52353658
>kill
>you are
>self

Sorry, I had to
>>
File: pretending.jpg (49 KB, 600x1104) Image search: [Google]
pretending.jpg
49 KB, 600x1104
>>52353668
>>
How to quit a python script:
1 / 0
That's the most evil trick I know, but I like it.
Thread replies: 255
Thread images: 40

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.