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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 327
Thread images: 30

File: 1485438720022.png (423KB, 720x720px) Image search: [Google]
1485438720022.png
423KB, 720x720px
Old thread: >>58973326

What are you working on /g/?
>>
File: programming-languages.jpg (129KB, 640x369px) Image search: [Google]
programming-languages.jpg
129KB, 640x369px
Reminder
>>
File: 9572010-R2-E037.jpg (254KB, 540x800px) Image search: [Google]
9572010-R2-E037.jpg
254KB, 540x800px
Stop using C#
>>
>>58980687
It's comfy and feature rich. it also has a very large library of extensions.

Memory is disposable now so it doesn't matter. Even then, it doesn't really take much more than emacs.
>>
File: dialects.png (21KB, 1142x491px) Image search: [Google]
dialects.png
21KB, 1142x491px
>>
>>58980760
Why the hell did you copy the java logo onto a picture of some random person?
Is that supposed to prove something?
Is that somehow supposed to make Java not shit?
>>
>>58980764
>comfy and feature rich. it also has a very large library of extensions
emacs and vim even more so

>Memory is disposable now so it doesn't matter
Well shit, I guess "advanced" editors all slowing to a crawl on some of my projects is just my fucking imagination eh?
>>
>>58980706
I'm working on a runtime editable RPG engine that translates its map's events to native code.
Guess the language.

>inb4 go to >>>/v/
>>
>>58980793
/g/ shitposters think we're attracted to 3D.
>>
>>58980793
Java is the best language. Wouldn't expect a lightweight like you to understand.
>>
>>58980760
stop using POO
>>
>>58980803
>Guess the language.
You're just trying to get (You)s.
It's probably Haskell or something.
>>
>>58980802
I use emacs for python, C++, Lua and other stuff.

Atom is handy for Electron for which emacs has poor/patchy support.
>>
>>58980858
>Needing different text editors for different languages
Are you stupid?
Why the hell do people do this?
>>
>>58980874
It's because I tried different editors and found that emacs is best for my workflow in certain languages, but lacks correct syntax highlighting and autocompletion for javascript, it also can't display directory trees as handily as Atom. It's really that simple.
>>
>>58980900
Knowing emacs users there sure is a plugin for better javascript autocompletion and highlighting.
>>
>>58980916
There is, but it can't handle jsx and its html-like elements, it also fucks up indents.
>>
>>58980706
What is the most reliable way of getting a global IP address? I tried checkip.dyndns.com, but it isn't reliable
>>
>>58981015
>getting a global IP address
What do you even mean by this?
Whose IP address are you talking about?
>>
>>58981030
He's probably talking about his external IP address rather than local.
>>
>>58981030
My global IP address
>>
I just got this job and everyone here thinks I'm that stupid guy who gets shit done fast

How long do you think I've got before I'm fired
>>
>>58981055
Why does your program need to know this?
Though, I can't really think of anything better than checkip.dyndns.com or something similar.
>>
>>58981081
I'm writing a peer to peer protocol (decentralized tv system)
>>
>>58981094
How are the peers going to discover each other?
>>
>>58981080
>I'm that stupid guy who gets shit done fast
what's wrong with this?
>>
>>58981112
I look like I'm retarded and/or not paying attention to shit. I don't want to look unqualified
>>
>>58981134
but you get shit done, fast at that. your job is secure, my friend.
>>
>>58981100
My information (IP, port) is created and signed with my private key, and is served on request (probably requesting it in bulk, but request it individually if we don't have it).
>>
>>58981140
I got shit done at my last job and they still fired me, and when I was there I looked smart
>>
>>58981168
So, similar to a bittorrent tracker, which is just going to return a list of peers?
Then that means that the clients don't even need to know their global IP addresses. The tracker will get it when the clients register with it.
>>
>>58981208
The peer information should be signed by the owner of the key for security reasons (Bitcoin wallet is tied to peer information, public key is used for encryption to the client, etc.)
>>
File: working hard.png (49KB, 519x247px) Image search: [Google]
working hard.png
49KB, 519x247px
>>58980706
Working on a text-based adventure game.
>>
>>58981263
Really cool and interesting project thanks for sharing it you totally didn't waste my fucking time fuck off and kill yourself you stupid worthless codemonkey
>>
>>58981263
Lewd!
>>
>>58981263
source code?
>>
>>58981263
Post source code. Not going to give you any comments/criticism if you keep it proprietary!
>>
>>58981263
>C
>not Ruby
ya dun goofed m8
>>
>>58981263
keep up the good work m8
>>
>>58981257
Where are you going to get the public key, though?
>>
>>58980719
I avidly code python, But by no means would I call it "high tier"...

its good for rapid development, but ungodly slow on computationally intensive operations
>>
>>58981311
>C
>not Ruby
>ya dun goofed m8
Your stupid. shut up.
>>58981263
>What do you do?
Expose boipussy
>>
File: 1477435479135.jpg (95KB, 897x869px) Image search: [Google]
1477435479135.jpg
95KB, 897x869px
>>58981263
nice
>>
>>58981321
Public keys are sent in the same way, except they aren't encrypted. Sockets can be created without encryption or with SSL and work like normal
>>
>>58981344
How does that even add security, then?
>>
>>58981340
b-but Ruby is more girlish
>>
>>58980835
Close, but no. It's Common Lisp. Haskell can't handle writing map's text files that are actually the code that builds it, nor editing its functions JIT. A dynamic scripting language could, but they're not compiled to native-code (which makes them slow).

I tried writing it in a functional style but it exploded in my face.
>>
>>58981351
SSL is for privacy concerns for encryption public keys

Encrypting the information with the node's public key, not only adds privacy, but validates the Bitcoin address associated with the network peer (if the key used to sign the peer is false, it would receive gibberish and not respond).

SSL doesn't allow the Bitcoin address validation (unless keys are derived from the peer keys)
>>
File: working harder.png (49KB, 515x279px) Image search: [Google]
working harder.png
49KB, 515x279px
>>58981343
>>58981313
Thanks!

>>58981340
In due time.

>>58981303
>>58981298
I'll post it when I'm done.

>>58981282
What's lewd about programming?

>>58981281
Hey, hey! We're all having fun here!
>>
After running through a lot of hoops, I can finally compile for old Mac OS under Linux. But of course, Linux doesn't give a shit about resource forks so I've got data fork and resource fork separated. What the fuck should I do about this? I've got an HFS floppy to copy it to, is there a Linux util I can use to add the resource fork I have separated to the data fork or am I fucked?
>>
This seems rather empty.

currently working on a small Go program to essentially "watch" my home network's public IP and if it changes (modem reboot or something) it will update the associated AWS route53 DNS record I have for it
not that this is too much of an issue with residential networks anymore, but it's a semi-interesting small project I can do in a week or two
>>
>>58980706
How do I stop codeblocks from crashing every three minutes?
It's becoming a pretty big entry barrier for me as I've just started learning c++
>>
>>58981919
Use something else.
>>
>>58981919
vim + make + gdb
>>
>>58981919
Just try a different IDE, they're all the same for beginners. Try Eclipse. It's not great, but it works. Or if you're on Windows just use Visual Studio Express or whatever the hell it's called now.
>>
>>58981919
gcc + nano + valgrind + make + git

you don't need anything else
>>
>>58981965
I've got both GVim and vim and I know i've got GCC in Xterm, but how do I compile and execute what I've made
>>
>>58982024
http://pages.cs.wisc.edu/~beechung/ref/gcc-intro.html

But don't listen to them, use a real IDE. There's no reason to mess with tedious shit just for street cred. I mean the IDE is just performing the gcc commands in the background for you.
>>
>>58982024
For the simplest stuff:
$ vim do_stuff.c
# edit file...
$ make do_stuff
$ ./do_stuff
>>
>>58981917
????????
>>
File: 1487230428164.jpg (156KB, 687x1000px) Image search: [Google]
1487230428164.jpg
156KB, 687x1000px
>>58980764
>comfy
>feature rich
>very large library
>disposable memory

Holy shit shills out in full force with their buzzwords, normal people don't talk like jewish salesmen
>>
>>58982052
Ok I've got it sorted, and I've gone some ways to doing some simple 2 integer calculation program but when i go to enter a number to select the next portion it must be calling all the different function menus because it returns
addition menu
subtraction menu
multiplication menu
division menu

is this because I didnt put the right rules in?
int selection1()
{
cout << "Please number a selection then press enter" << endl;
int a;
cin >> a;
return a;
}
int additionmenu1()
{
cout << "addition menu" << endl;
}

int subtractionmenu1()
{
cout << "subtraction menu" << endl;
}

int multiplicationmenu1()
{
cout << "multiplication menu" << endl;
}

int divisionmenu1()
{
cout << "division menu" << endl;
}

int ruling(int a)
{
cout << "ruling menu" << endl;
if(a=1);
additionmenu1();
if (a=2);
subtractionmenu1();
if (a=3);
multiplicationmenu1();
if (a=4);
divisionmenu1();

return 0;
}
void menu1()
{
system("clear");
int a;
cout << "Basic calculator program" << endl;
cout << "By Chan!" << endl;
cout << endl;
cout << "What kind of calculation do you want to carry out?" << endl;
cout << "1) Addition" << endl;
cout << "2) Subtraction" << endl;
cout << "3) Multiplication" << endl;
cout << "4) Division or" << endl;
cout << "5) Exit the program" << endl;
cout << endl;
selection1();
ruling(a);

}


int main()
{
menu1();
return 0;
}
>>
File: nazmmlf.png (43KB, 286x366px) Image search: [Google]
nazmmlf.png
43KB, 286x366px
>>58982024
gcc -o myexecutable testfile.c

the '-o' stands for 'output'. Immediately after output, you put what you want the output to be.

If you have multiple .c files, you'll need to compile them first, like so:

gcc -c -o test1.o test1.c
gcc -c -o test2.o test2.c

the '-c' compiler flag allows the compiler to compile your file without needing a 'main' function.

after you compile, link like this:

gcc -o myexecutable test1.o test2.o main.c
>>
>>58982024
clang++ -o program program.cpp

you'll pick up the rest of the flags as you learn
>>
>>58982123
You're calling selection1() and not doing anything with the value.

Your if statements are not doing what you want them to be doing.
>>
>>58982128
>after you compile, link like this:
>
>gcc -o myexecutable test1.o test2.o main.c
No, link explicitly using ld, fucking pajeet.
>>
File: 1486170337578.jpg (106KB, 593x578px) Image search: [Google]
1486170337578.jpg
106KB, 593x578px
>tfw too dumb for Rust
>>
Bill Gates is the best programmer of all time. Windows Operating System cannot be beat
>>
>>58982292
China #1, America sux!
>>
File: wewlad.webm (680KB, 704x96px) Image search: [Google]
wewlad.webm
680KB, 704x96px
>>58982292
>>
>>58981328
It's a bait image don't fall for it
>>
>>58982252
Never heard of ld before. Tried it out, didn't work.
>>
>>58980719
Everything is exactly backward, except POO tier is accurate, and idk about Go.
>>
>>58982493
Good Christ dude.

http://lmgtfy.com/?q=gnu+ld
>>
Currently working through Jonesforth with the intention to bind to OpenGL and friends as C is a pain to work in.

The current implementation uses threaded code but will implement a non-interactive compile mode where threading is discarded and code formatted to procedures/inlined to improve speed since code size isn't really an issue on modern platforms (plus I already have a threaded base for the compiler).
>>
>>58982507
Thanks bro, I tried it out on a project of mine and keep getting errors. I've known about it for 5 minutes and I'm fucking tired, go fuck yourself.
>>
>>58982542
just use clang/gcc -o program program.? for now and deal with ld if you need to deal with asm
>>
>>58982542
Get some sleep and read about it in the morning. Do just ask why it doesn't work just like GCC.

When you call gcc it calls ld, ld is the linker. Just like gcc doesn't immediately generate binaries, it generates assembly and then calls 'as' to assemble the program.
>>
>>58982542
also what is man ld? Use the man pages... they exist for a reason
>>
>gcc requires you to specify all your files in one command
>Ada just needs the main file, because you obviously just want to compile everything
Bravo?
>>
Just got back from an intro to cs practice exam

pretty irritated, all of the exams (about 55% of the grade) are on paper and are just composed of exercises from the book that you have to do ON PAPER. Like it says "write a program on this sheet of paper that does x".

Why the fuck is this a thing? It's not supposed to be pseudocode, you're supposed to meticulously write out all the brackets, semicolons etc. and it needs to compile and act flawlessly on your first try of just writing out a program linearly, which is now how you develop programs. Fuck I mad
>>
>>58982601
Until codebase and build times get fuck huge, then C's compilation method with a makefile system is superior.
>>
>>58982641
no, make can handle projects of arbitrary size

99% of projects that use automake and similar don't need it at all
>>
>>58982641
[spoiler] it's a make system but it's hidden from the user, until you use a gprbuild [/spoiler]
>>
>>58982627
Cry more
>>
>>58982654
>99% of projects that use automake and similar don't need it at all
Of course. Autotools is shit. Cmake is better, but people tend to overuse it in the same way.
>>
>>58982627
That's how it was at my school. Sounds pretty standard, friendo.
>>
>>58982627
Why is that too much for you? Writing correct programs is easy when it comes to paper and I'm guessing it's not over 500 loc so shouldn't be a problem.

I usually write out my programs on paper before typing them up anyway as it forces careful design rather than programming in the interpreter/text editor and checking if it compiles.
>>
>>58982627
i saw that shit too, don't know why they do it.

>>58982562
>>58982566
>>58982573
alright, ld is on my TODO
>>
>>58982677
Good now go learn forth and you'll be set to do anything
>>
>>58982662
Interesting point is that gprbuild uses Ada syntax, whereas make uses weirdo scripting syntax.
>>
>>58982627
They do it because they're a school and they're teaching you concepts.

They're not going to coddle you with expensive tools and they're not going to make their job harder just to make you happy. You're not in high school anymore and you're not a customer, you're a student. Yes, it's awkward. Deal with it.
>>
>>58982627
this is how you learn problem solving and logic properly

also git gud
>>
Learning C++ from Python.
Can you assign a function to a variable in C++?
>>
>>58983068
C (and thus C++) has function pointers, but if you're using C++ I recommend taking advantage of Object Oriented design and using abstract classes.
>>
>>58983068
http://en.cppreference.com/w/cpp/language/lambda
>>
>>58983068
What the fuck does that even mean?
>>
>>58983098
For example if you wanted to create a sort algorithm that allows for custom comparisons. You'd pass it the list of objects to sort as well as a function for it to call that defines how to compare two objects.
>>
>>58983098
>Can you assign a function to a variable
I am not sure how else can I explain this

>>58983086
>>58983092
Will do thanks
>>
what programming language do nekos like?
>>
>>58983124
Oh, so they guy meant pass a function as a variable?
>>
Does anyone have SDL experience? I'm doing a little 2D game that has some readable signs for use in a tutorial level.

When you read the sign, a textbox shows up, and you can hit space to continue on to the next text box.

The problem is the only way I know to clear the text box is to clear the game renderer, but then the rest of the game gets cleared as well so every text box after the first just has a black background until the game starts running in real time again.

Is there a way I can save whats currently on the screen before the textbox function runs so that I can simply redraw that between text boxes?
>>
>>58983181
You could store it in a variable for other reasons if you wanted, but generally you want to do it for passing to another function.
>>
>>58983181
He didn't say anything about passing it, he just said assign.
Like, void *a = &func;
Not complicated.
>>
if i do
a = b = new int[5];

in java
will modifying any slot in b affect a's slots?
>>
If the big 5 use some combination of cpp, java, python, [4th lang here], then what is the point of learning something different?
>>
>>58983208
That's assigning a variable to a function.
>>
>>58983215
Yes, you're copying a reference to the array. If you want a new array use b.clone();
>>
>>58983222
>then what is the point of learning something different?

Fun? Exposition? Learning something fresh?
>>
>>58983222
Very few languages that you would have heard of don't get used somewhere. Besides, once you got a good grasp of the basics, pretty much every programming language that isn't a functional programming language will be piss-easy to learn, so it's not like there's some huge commitment to learning, say, Ruby.
>>
>>58983228
Technically, I'd agree. But he was just using language in a sloppy manner. It was clear what he meant.
>>
File: Happy student.png (277KB, 1919x1079px) Image search: [Google]
Happy student.png
277KB, 1919x1079px
Thanks to advice from /dpt/ I'm back to learning (I found that kate was the most helpful for me out of VIM, tex, geany and emacs)
Thanks lads
>>
>>58983324
I don't agree. Do you assign a player to a number or do you assign a number to a player? Both, really.
>>
>>58983400
holy shit this faggot uses an object oriented programming language haha
>>
>>58983450
Sticks and stones may break my bones but indians will never poo in the loo
>>
>>58983433
When using the word in a technical sense, values are assigned to variables, not variables to values.
>>
>>58983433
Do you assign x to 5 or 5 to x?
>>
>tfw you're programming but get a strong urge to jack one out
it wouldn't be so bad if it my sessions didn't last at least two hours
>>
>>58983525
i assign my cock to you are mom
>>
       If (A < B) Then

End If


OR

       If A < B Then

End If
>>
>>58983581
if a < b then

else {- obligatory -}

-- end (optional)
>>
>>58980706

I'm still trying to figure out how to average two integers...
>>
>>58983612
explain what you mean by all that please
>>
>>58983634
What language? C has complex.h to help with this sort of thing
>>
>>58983581
if A < B then
...;
end if;
>>
>>58983647
you can delimit it with indentation

else is mandatory because it is an expression and returns a value
>>
>>58983653
Brainlet needs help to properly round his integer division
>>
File: 1444465059754.jpg (144KB, 661x765px) Image search: [Google]
1444465059754.jpg
144KB, 661x765px
>>58983667
no idea what you meant
>>
I'm using pandas in python and I have the data set in pic related. How would I plot this using matplotlib (Date vs Opening Price)?

I was told to do something relating to DateTimeIndex

import pandas
import matplotlib.pyplot as plt

csv_list = pandas.read_csv("AAPL_2008-2017.csv")
print csv_list
>>
File: I made a thing.png (22KB, 355x314px) Image search: [Google]
I made a thing.png
22KB, 355x314px
I made an integer calculator
It can only do two sets of integers and only one modifier but hey it's a start
#include <iostream>

using namespace std;

int add(int x,int y)
{ return x + y; }

int subtract(int x,int y)
{ return x - y; }

int multiply(int x,int y)
{ return x * y; }

int divide(int x,int y)
{ return x / y; }

int main()
{
cout << "give two integers to calculate" <<endl;
int x;
int y;
cin >> x;
cin >> y;
cout << "You've selected integers " << x << " & " << y << endl;
cout << endl;
cout << "Please select a mode of calculation" << endl;
cout << "1) Addition" << endl;
cout << "2) Subtraction" << endl;
cout << "3) Multiplication" << endl;
cout << "4) Division" << endl;
int a;
cin >> a;
cout << endl;

//addition
if (a == 1)
{
std::cout << "You've selected " << a << ":, addition." << std::endl;
std::cout << x << " + " << y << " = " << add(x, y) << std::endl;
}
//subtraction
if (a == 2)
{
cout << "You've selected " << a << ":, subtraction." << endl;
cout << x << " - " << y << " = " << subtract(x, y) << endl;
}
//multiplication
if (a == 3)
{
cout << "You've selected " << a << ":, multiplication." << endl;
cout << x << " X " << y << " = " << multiply(x, y) << endl;
}
//division
if (a == 4)
{
cout << "You've selected " << a << ":, division." << endl;
cout << x << " / " << y << " = " << divide(x, y) << endl;
}
//end of operations
cout << "thanks for using this calculator" << endl;
}
>>
>>58983828
The "thanks for using this calculator" message isn't quite effusive enough.
You need to really pour your heart out to the user - maybe go a little over the top with how grateful you are that they're using your calculator.
>>
>>58983828
Good job! If you want to improve this by being able to add more than two numbers, try looking into stacks and queues

Also, even though I have legacy captcha turned on in the settings, I'm being asked to click on picture of jeans, what gives?
>>
>>58983828
please delete this
>>
>>58983824
plt.plot(csv_list.Date, csv_list.Open)

Try this
>>
>>58983725
Thank you, piggu-chan
>>
just contributed another pull request to a completely mismanaged open source project that will probably never get merged
>>
>>58983828
import Text.Printf (printf)
f 1 = ((+), "addition", "+")
f 2 = ((-), "subtraction", "-")
f 3 = ((*), "multiplication", "*")
f 4 = (div, "division", "/")


main = do
putStrLn "give two integers to calculate"
x <- readLn
y <- readLn
mapM_ putStrLn [printf "You've selected integers %d & %d\n" x y,
"Please select a mode of calculation" ,
"1) Addition" ,
"2) Subtraction" ,
"3) Multiplication" ,
"4) Division" ]
o <- readLn
let (op, name, infx) = f o
printf "You've selected %d:, %s.\n" o name
printf "%d %s %d = %d" x infx y (x `op` y)
putStrLn "thanks for using this calculator"
>>
>>58983914
So what happens if I enter "5"?
>>
>>58983900
I got a weird error
>>
>>58983922
Ask >>58983828
>>
>>58983864
gno
>>58983914
I'll be fucked if I can understand these revisions, is this still C++?
>>58983930
It shows a blank and says "thanks for using this calculator"
Which is a great way of saying "fuck you, put in the right number"
>>
>>58983938
>I'll be fucked if I can understand these revisions, is this still C++?
No, that's Haskell
>>58983938
>It shows a blank and says "thanks for using this calculator"
>Which is a great way of saying "fuck you, put in the right number"
Well, I guess I need to change it a bit then

>import Control.Monad (when)

>when (o > 0 && o < 5) $ do
> let (op, name, infx) = f o
> printf "You've selected %d:, %s.\n" o name
> printf "%d %s %d = %d" x infx y (x `op` y)
>>
>>58983914
There's something very alluring and beautiful about this kind of code.
I mean... a dumb calculator program has become pleasurable to read. Maybe I should learn Haskell.
>>
File: futaba_mad.png (27KB, 123x163px) Image search: [Google]
futaba_mad.png
27KB, 123x163px
>>58980706
>code isn't doing what I tell it to do
>fix it
>add some more stuff
>code isn't doing what I tell it to do again
I'm so fucking sick of this shit
>>
>>58983828
Are you brand new to programming?

Nice start, but look up what a switch is in C++. If you're going to check for exact values, like 1 2 3 or 4, a switch will clean your code up a good bit.

Also don't forget your return 0;
It wont really matter but it's good practice to follow standards, and the standard says main returns an int.
>>
>>58983959
Sounds like you're bad at debugging.
>>
>>58983952
this might be nicer


[x,y] <- sequence [readLn, readLn]
>>
>>58983948
Haskell huh, a lot of it looks nice and intuitive but some of it looks really counter intuitive like
main = do

why would you need to tell the compiler to do the main function? Regardless you were able to do what I did in a third of the space
>>58983962
Maybe 3-4 hours in? Yeah I'm new
I mostly forgot to return 0 because im executing it in mate terminal which isnt showing return values
>>
>>58983975
That is nicer. It's weird, I don't usually have this kind of aesthetic reaction to code, but this is some elegant shit.
>>
>>58983828
Honestly looks pretty amateur hour compared to my recursive multiplyInts function, but still decently impressive.


int multiplyInts(int a, int b) {
multiplyInts(b, a);
}

/*
****************
* multiplyInts
* Take a and multiply it by b and c and d and e and f and g and h and i and j and k and l and m and n and o and p
* then return the result
****************
*/
int multiplyInts(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n, int o, int p) {
multiplyInts(p, multiplyInts(o, multiplyInts(n, multiplyInts(m, multiplyInts(l, multiplyInts(k, multiplyInts(j, multiplyInts(i, multiplyInts(h, multiplyInts(g, multiplyInts(f, multiplyInts(e, multiplyInts(d, multiplyInts(c, multiplyInts(b, a)))))))))))))));
}

>>
File: wasa_think.png (189KB, 500x500px) Image search: [Google]
wasa_think.png
189KB, 500x500px
>>58982627
>be in linguistic class
>exam tells us to analyze the grammar and morphology of a specific set to words in some language
>phrase everything in mathematical terms
>get the right answer through using rigorous definitions and algorithms for the process of linguistic analysis
>get a 0 for the problem
>apparently the TA knows jack shit about theory of semigroups
>appeal to prof
>he won't rectify my points since he hates Chomsky
>mfw
Wow what a terrible establishment
>>
>>58983984
>why would you need to tell the compiler to do the main function? Regardless you were able to do what I did in a third of the space
Haskell is pure and everything is an expression.

"do" means begin a do block, kind of like "switch" begins a switch block

A do block sequences actions, i.e.

do
putStrLn "hello"
readLn


performs the first action, (putStrLn "Hello"), then the second action, (readLn)
(returning the result of the second action)
in infix notation it can be written as
(putStrLn "hello" *> readLn)

Since I wrote
main = e
I am saying that main is equivalent to e.
If I were just writing to the console, I wouldn't need the do block
main = putStrLn "Hello"
The do block is there to combine and chain actions (with nice syntax)

Obviously you might want to 'get the result out', and that's what the
<-
is for. (well, actually it's more like a continuation, but nevermind)

do
x <- readLn
putStrLn x


Haskell is statically typed, and has a very nice type system.
readLn gets a line from the console and parses it - but you can decide what type you get back
(readLn :: IO String)
(readLn :: IO (Int, Int))
(readLn :: [Double])

Haskell sees that you call putStrLn (which takes a String), so it knows the type of x is String
From that it can infer which version of readLn you want.
>>
>>58983926
Try this

csv_list.date_to_plot = pd.to_datetime(csv_list.Date, format='%Y-%m-%d')
csv_list.set_index(csv_list.date_to_plot,inplace=True)
plt.plot(csv_list.index, csv_list.Open)
>>
File: ralph.jpg (10KB, 480x360px) Image search: [Google]
ralph.jpg
10KB, 480x360px
>>58980706

I start both my degree and another external course in ten days, I've been vehemently working through the modules I've been allowed access too. I'm about four weeks ahead of schedule. Rather enjoying the process of learning a new language and a new skill.

I'm working on a Paint clone for one of the assignments, based on the default application with Windows and Paint.net. Unfortunately VB doesn't have a ribbon so I'm stuck trying to make it look pleasant with the default toolbox.
>>
>>58983984
>>58984030
So similarly, say you wanted to prompt the user, giving them a string input and then getting back a result

prompt :: Read a => (String -> a)
-- the type of prompt is as follows
-- where (a) is a Read type*
-- A function from String to a

-- s is the parameter
prompt s = do
putStrLn s
readLn


You aren't actually telling Haskell to perform this action, you're just describing it, saying that "prompt s" is equivalent to the following action.
You could then use this action in main:

main = do
x <- prompt "Can I get your number please?"
putStrLn x


When compiled, the action "main" describes the entire program.
>>
>>58984056
whoops, should be
(String -> IO a)
because it returns an IO action that evaluates to a
>>
>>58984041
Would you say you've been working through them more voraciously, or vehemently? Because working through modules vehemently is a little unusual.
>>
>>58984067
it's just a stupid shitkid who thinks words are interchangeable

i bet he uses the word "literally" when it's not needed
>>
>>58980760
That's a man
>>
>>58984005
Down a letter grade for not doing it in Java
>>
>>58984032
Holy shit dude, it worked!

You're a fucking beast and I love you.
This probably sounds really weird but I've been programming in python for four fucking hours straight trying to finish this assignment and I hate everything. This has literally been the only good thing that's happened this week.

You're a god
>>
>>58984030
>>58984056
>You aren't actually telling Haskell to perform this action, you're just describing it
In this regard it sounds so far apart from C++
>>
>>58984108
is haskell a declarative language, in that regard?
>>
>>58984067

More so vehemently I would assume, it's been a very emotionally fulfilling endeavour with a definite intense passion more so than I've felt for other projects. I have been voracious with my googling and note taking however.
>>
>>58984102
Glad I could help. Good luck for your assignment.
>>
>>58984108
yes, it is

also GC (unfortunately)

>>58984122
yes
>>
so I have an "archive" object that contains files within it
the user does something like

archive.open("container_file.pack") and accesses individual files like

Entry curEntry = archive.getentry("honk/blah/file.txt")

and proceed to do stuff like curEntry.read(...) curEntry.seek(0xbeef) etc.

When I make the "Entry" type store a reference to the "archive" that created it. Should it be a weak_ptr? How could I safely the parent archive being deleted and having dangling entries?
>>
File: rust_control_over_safety.png (38KB, 1207x826px) Image search: [Google]
rust_control_over_safety.png
38KB, 1207x826px
>3 years of distrohopping
Stopped at Ubuntu GNOME
>8 years of programming language hopping
>tfw still haven't found my favorite language
I finished studying (most) of Golang specs in this year, what's the next step for me?

I'm tempted to Rust, to be honest.

>What I liked about go
Easy. It's intuitive, simple and better performant than Oracle Java and Microsoft Java. The language is easy to develop with and the compile time is blazing fast.
If I ever see Google Android is pushing Golang and Gootools to develop Android Apps I will definitely come back to Go.

>What I don't like about Golang
It pretends to be a general purpose programming language while it's actually more (actually most) focused on writing web apps.
I have almost no use for Network/Server side language. I'm interested in desktop/mobile applications.

Golang does not have a complete gtk3 binding. As I am writing this today Go 1.8 was released and it has no focus on GUI libraries/utilities.

However Rust has a complete gtk3 binding, people actually wrote wayland window managers with Rust.
I don't expect Rust to be well suited for Android development but I'll enjoy writing small applications for Linux with Rust.

Thanks for reading my blog.
>>
>>58984336
F# or Rust then Haskell
>>
>>58984336
But go isn't faster than Java.
It's slightly faster sometimes, and other times gets its asshole reamed by it.

> https://benchmarksgame.alioth.debian.org/u64q/go.html

Also, what safety features do Rust offer that say, Java, doesn't?
>>
>>58984363
Rust eliminates chances of data race which neither of Microsoft or Oracle Java can't.

While being faster.
>>
>>58984363
sanity
>>
>>58984363
Lifetimes, ownership, and so on.
>>
>>58984336
If you put Rust about on the level of Java on the "Performance" scale this would be right.
>>
>>58984401
Even Go is faster than Java
>>
>>58984494
even Java is faster than Java
>>
File: uss.png (88KB, 1674x896px) Image search: [Google]
uss.png
88KB, 1674x896px
>>58984097
I've beefed up my resume by writing a program in Java - let's get real, meme languages like Haskell and C++ aren't going to get me a job.
The program's pretty simple:
You enter a starting amount, and a monthly interest rate, and it will calculate the total interest amount for the year.
Works pretty well, code looks nice and professional, and I'm feeling like I finally got the hang of programming.
>>
>>58984525
Forgot to add a link. You can run it yourself here: https://repl.it/FnVk/0
>>
>>58984525
You should make the interest calculator an Object rather than a function in your main object.

Wouldn't hurt to have a calendar object to keep track of the months in a year either
>>
What are some reasons against C#?
Why do people dislike it?
>>
>>58984614
OOP
>>
>>58984571
That's a good idea.
Here's a rough concept for the class structure so far. Seems promising.
So now the January subclass of the abstract Month class will contain the CalculateMonthlyInterestForYearUntilJanuary function, and the Calendar class will take care of moving to the next month, calculating interest until the current month, etc.
class Calendar {
private static Month currentMonth;

public static Month GetCurrentMonth() {
return currentMonth;
}
public static void AdvanceMonth() {

}
};

abstract class Month {
private static String MonthName;
abstract public Float GetInterestUntil(Float principle, Float interest);

public String GetMonthName() {
return MonthName;

}
};

class January extends Month {

private static String MonthName = "January";

public Float GetInterestUntil(Float principle, Float interest) {
return 1.0f;
}

};
>>
>>58984525
the fuck?
>>
>>58984525
>>58984644
Is this the next step to Professional Business Java FizzBuzz?
>>
>>58984644
this shit makes me not want to program.
>>
>>58984644
this is what dijkstra wanted to stop
>>
>>58984644
>not having a factory to create months
I hope you're still in alpha, son.
>>
>>58984621
Why is that a bad thing?
>>
File: 1464897384190.jpg (991KB, 2560x1714px) Image search: [Google]
1464897384190.jpg
991KB, 2560x1714px
My dudes, let me ask you I have a bunch of JetBrains IDEs in my computer, but since I'm too jewish to shell out the money for them I use a license server

But the IDEs require the license server to boot every 2 days or so, and I dont like having to do that shit, is there any script I can write, perhaps a service I can create that can boot up the server and authenticate all of the IDEs automatically when booting up windows?

Anyone do something similar, perhaps can share what did you do as a solution? Or what would you do?
>>
>>58984708
Because abstraction is the opposite of OOP.
>>
>>58982119
Yeah a salesman for free software

only on /g/ can people be so dumb
>>
>>58984710
3DPD piggu go homu!
>>
>>58984731
Okay, but in reality, unless you're in the 10% that will actually write more complex solutions, you will not face any problems of oop.
>>
>>58984762
The majority of programmers are not writing fizzbuzz
>>
>>58984772
You are correct, they write in C#
>>
>>58984102
Assignment? Are you doing that Python for data science course on Coursera?
>>
I'm making a strategy game.
I can generate/draw fake world, but I prefer familiar shapes, so I'm trying to find OSM contour-only tiles without labels, roads etc.
>>
Why is OOP bad? I get it if you want to get with the times, but if you work in a business and make solutions for windows, OOP is the way to go.
Is it a meme?
>>
File: uss2.png (69KB, 1788x813px) Image search: [Google]
uss2.png
69KB, 1788x813px
>>58984571
Alright, I finally finished the switch over to a more OOP-oriented design.
It's still a pretty simple system, but works like this:
The abstract month class has subclasses for each concrete month (Jan through Dec).
Then the Calendar can be used to store a current month, or move to another month.
The Calendar class is a bit like a Month factory, as this anon suggested >>58984692

So when a month has to calculate the interest leading up to it, it can create a new Calendar, and use that to create the previous month which can then calculate its interest, etc.

Full code available here: https://repl.it/FnXH/1

Here's the Calendar class.
class Calendar {

private static Month currentMonth;

public Calendar() {
//Default
SetMonth("January");
};

public static Month GetCurrentMonth() {
return currentMonth;
}
public static void SetMonth(String monthName) {
switch(monthName) {
case "January":
currentMonth=new January();
break;
case "February":
currentMonth=new February();
break;
case "March":
currentMonth=new March();
break;
case "April":
currentMonth=new April();
break;
case "May":
currentMonth=new May();
break;
case "June":
currentMonth=new June();
break;
case "July":
currentMonth=new July();
break;
case "August":
currentMonth=new August();
break;
case "September":
currentMonth=new September();
break;
case "October":
currentMonth=new October();
break;
case "November":
currentMonth=new November();
break;
case "December":
currentMonth=new December();
break;
default:
currentMonth=new January();
break;
}
}
};
>>
>>58984897
OOP encourages programmers to write code with a lot of shared mutable state.
Shared mutable state is a cancer.
>>
>>58984525
>>58984899
Please tell me this is satire.
>>
>>58984897
OOP is the opposite of abstraction
>>
>>58984904
Why?
>>58984940
What does that even mean.
>>
>>58984945
>Why?
Why what?
>>
>>58984945
OOP is about thinking in terms of real world objects
>>
>>58984401
But Rust is faster than Java: http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=rust&lang2=java
>>
File: help.jpg (11KB, 146x78px) Image search: [Google]
help.jpg
11KB, 146x78px
what do i have to write so i don't have to create f? &{}?
>>
>>58984954
OOP is about thinking in terms of discrete, self-contained objects. *Not* real world or physical objects (at least, not necessarily.)
That's a strawman.
OOP is completely compatible with abstraction.
>>
>>58984970
Completely wrong, OOP is about real world objects.That's why OOP fails so badly at abstraction, and you end up with stuff like "XYZFactoryManager" because you need to think about it as an object, and the closest actual object is a factory, and then that has a manager, etc.

OOP is terrible at abstraction.
>>
>>58984967
int *test = (int[]){ 1, 2, 3, 4, 5, 6, };

Note: the lifetime of the array is only the block it's defined in, so it is not appropriate to return this from a function.
>>
>>58984983
It obviously doesn't have to be real world objects.
Is writing something like this incompatible with object orientation?
class Vec3 {
public:
float x,y,z;
float DotProduct(Vec3 dotWith);
float Normalize();
//etc.
};
>>
>>58985001
>it doesn't have to be real world objects
it has to be something you could think of as a real world object, and then you arbitrarily get rid of properties of real world objects because you need to in order to program
>>
>>58984995
Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax Project1
>>
>>58985013
Are you using meme++ or some shit?
What I posted there is clearly valid C.
>>
>>58984932
It's easy to criticize code you don't understand, Mr. Smarty-pants.
I solved a difficult mathematical problem with only fourteen classes (including the abstract class and its subclasses) and 232 lines of code.
If that's so bad, why don't you come up with a better solution?
Protip: you won't because you can't.
>>
>>58984953
Why is it cancer?
>>
>>58985016
there is nothing wrong with c++
>>
>>58984897
>Why is OOP bad?
because typeclasses solve the problem better
>>
>>58985051
i.e. you first need to have a proper type system
>>
>>58985048
Shared mutable state?
Do a really need to explain something so fundamental?

>>58985049
You are so naive. C++ is terrible language.
>>
>>58985049
this post is wrong in almost every regard


just like C++
>>
>>58985062
Yes, explain why is it cancer
>>
>>58985100
It makes it very difficult for you to reason about your programs.
It makes it very hard to parallelise and scale your program.
>>
>>58985123
use functional languages amirite xD
>>
>>58985164
what's wrong with functional languages?
>>
>>58985174
Which languages are used in businesses, enterprises? OO ones.
>>
>>58985164
You're a fucking idiot.
>>
>>58985186
Kill yourself.
>>
>>58985179
No, imperative/procedural ones

>C
>C++
>C#
>Swift
>Rust
>Javascript
etc

none of those are OO
>>
>>58980719
>muh hacker

>fell for the jewgle meme language


lol you can bet the binaries will be binded with some keylogging wife-spying crap
>>
>>58985022
#include <stdio.h>
#include <string.h>
#include <tgmath.h>

static const char *const months[12] = {
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
};

int get_month(const char *input)
{
for (int i = 0; i < 12; ++i)
if (strncmp(input, months[i], strlen(months[i])) == 0)
return i + 1;

return 0;
}

int main(void)
{
char buf[64];

puts("Enter the end month:");
fgets(buf, sizeof buf, stdin);

int month = get_month(buf);
if (month == 0)
goto error;

puts("Enter a principle:");
fgets(buf, sizeof buf, stdin);

float principle;
if (sscanf(buf, "%f\n", &principle) != 1)
goto error;

puts("Enter monthly interest rate:");
fgets(buf, sizeof buf, stdin);

float interest;
if (sscanf(buf, "%f\n", &interest) != 1)
goto error;

printf("%.2f\n", principle * pow(1.0f + interest, month));
return 0;

error:
puts("Invalid input");
return 1;
}
>>
>>58985051
[citation needed]
>>
>>58985218
So why the stigma that C# and vs ide is bad?
>>
>>58985215
Reasoning about programs are scalability has absolutely nothing to do with function programming or any particular programming paradigm.
You retarded POOfags always try to steer this into an FP vs OOP arguments, probably because you're insecure or some shit.
>>
>>58985266
>are scalability
and*
>>
>>58985174
Functional languages like javascript are fine, but autists wouldn't agree to call them "functional". Truly functional languages like Haskell and his derivatives are too strict and hard to grasp.
>>
>>58985290
Haskell is neither strict nor hard to grasp
>>
>>58985290
Haskell isn't too hard to grasp. You're just retarded. Haskell is a line noisy pile of shit though. It has an ugly macro system. If you want to make seamless extensions to the language, tough shit. It has a deficient module system (look at Common Lisp packages in comparison). And it has nothing like Lisp's condition system.
>>
File: flying_gopher.jpg (70KB, 800x494px) Image search: [Google]
flying_gopher.jpg
70KB, 800x494px
Go 1.8 just released. 25-30% faster on non x86_64 architectures. GC pauses guaranteed to not exceed 100 microseconds and usually ~10 microseconds. Why aren't you programming in Go?
>>
>>58985333
Who cares?
Go is fucking shit.
>>
>>58985339
Who cares? All languages are shit.
>>
>>58985320
(standard) Haskell doesn't have a macro system

also its modules are shit
>>
>>58985309
By "strict" I mean "refuses to do anything until your code is error-free", not evaluation strategy. Good typesystem forces you to write correct code and that feels like a BDSM.
>nor hard to grasp
Yeah, yeah. It's as easy as JS as soon as you understand that monad is just a monoid.

>>58985320
>99% of coders are just retarded
Fixed.
It is hard to grasp not because it is really hard, but because it is too different from all the other languages. Even in OCaml you can think in an imperative way. In Haskell you have no other choice but to switch your mind to the functional way of thinking, even when writing sequential code in do-notation. That makes it hard for those who has learned to code in traditional languages, i.e. for all the real developers.
>>
>>58985348
Computing is shit. Technology is shit.
>>
>>58983400
geany is better
>>
>>58985333
Meme
>>
>>58985365
Life is shit.
>>
>>58985362
>Good typesystem forces you to write correct code and that feels like a BDSM.

just write a javascript-like-type, like the one in Data.Aeson, and use that
>>
>>58985362
>to code
Opinion invalidated.
>>
>>58985376
What? You can write retarded as fuck code in any language, good type system or not. And an overbearing type system isn't always a good thing. Just look at Haskell and the Y combinator for a tiny example.
>>
>>58985403
Sorry, that was meant for >>58985362
>>
(>>58985403) (>>58985403)
Nobody needs Y(ou).
>>
>>58984525
fucking aids
>>
File: C4T2hdsW8AchnM8.jpg (154KB, 1126x930px) Image search: [Google]
C4T2hdsW8AchnM8.jpg
154KB, 1126x930px
Programming student here, want to create a social networking app that's based on Peer to Peer protocol. Think it's possible? If yes, where do I get started?
>>
>>58985423
For something invented by Haskell himself, you'd think a language named after him could do something so simple without ugly hacks.
>>
>>58985450
It's completely impossible. You will never succeed.
>>
>>58985461
I said it before, nobody needs Y
>>
>>58985477
>muh sour grapes
>>
>>58985485
Yet another stupid response
Y did I expect any differently?
>>
>>58985495
Not an argument.
>>
File: CuIuI9HWgAAPMPp.jpg (45KB, 800x796px) Image search: [Google]
CuIuI9HWgAAPMPp.jpg
45KB, 800x796px
>>58985472
Tf u mean senpai? I will succeed just you watch.
>>
>>58985246
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.8567&rep=rep1&type=pdf
>>
>>58985450
Absolutely p2p networks are a pain in the arse, specially for nontechnical users. Going for a decentralised federated system will be actually viable, maybe you could learn enough to actually suspect what you're doing.

https://en.m.wikipedia.org/wiki/Distributed_social_network
>>
>>58985461
It wasn't because of him discovering the Y contaminator that haskell was named after him
>>
>>58985513
>class Pricing p lineItem pricer charger item customer
>| p −> lineItem pricer charger item customer
>where
>pricer :: p −> lineItem −> pricer
>customer :: p −> lineItem −> customer
>item :: p −> lineItem −> item
>quantity :: p −> lineItem −> Int
>basicprice :: p −> pricer −> Double
>discount :: p −> pricer −> Double
>cost :: p −> charger −> Int −> Double −> item −> Double
>charge :: p −> item −> charger

wew looks like someone needs lenses
>>
>>58985548
>lenses in 2006
big boi
>>
>>58985538
>take some unsuccessful FP language and name it after a logician
>uses none of said logician's ideas
Okay.
>>
>>58985548
>Structs/records and functions that work on them are OOP
Fucking idiot.
>>
File: 1486803106244.gif (746KB, 500x400px) Image search: [Google]
1486803106244.gif
746KB, 500x400px
>>58985579
w-what?
>>
>>58985513
>Java and C# object systems are the pinnacle of OOP
You're going to have to try harder.
>>
>>58985625
What is the pinnacle of OOP?
>>
>>58985637
JavaScript.
>>
>>58985637
C#. don't listen to the java shills promoting their shitty garbage collector of a language.
>>
File: 8n2lk.jpg (21KB, 562x562px) Image search: [Google]
8n2lk.jpg
21KB, 562x562px
>>58985530
That was actually quite helpful mate. Thanks.
>>
>>58985655
Object.prototype = "fuck you"
>>
>>58985577
he discovered a phenomenon, it's like saying gravity was anyone's idea.
>>
>>58985637
A good dynamic metaobject system with multiple dispatch will eliminate most of the problems outlined in the paper.
>>
>>58985746
>what is
>what could become
>>
>>58985777
This is already implemented in CLOS.
>>
>>58985637
This is a meaningless question. That's like asking "what's the pinnacle of communism?"
>>
>>58980719
Poo tier is accurate. Everyrthing else is literally the opposite of reality.
>Captcha: Street Mexico
>>
>>58985896
It's more like saying
>>Java and C# object systems are the pinnacle of OOP
>You're going to have to try harder.
>>
>>58985942
What is this reddit-tier formatting? Delete this and rewrite your entire post, then we can talk.
>>
>>58985954
It's called quoting you retarded baby
>>
>>58985933
>Poo tier is accurate
only if you add sepples to the list
>>
>>58985959
>Who am I quoting?
>>
What is the difference between:
const int *ptr
const int *const ptr
int const *ptr
int *const ptr
?
>>
>>58986032
const int * = (const int) *
const int * const = (const int) (const *)
int const * = (const int) *
int * const = int (const *)
i think
>>
>>58980765
By
>>
>>58986032
const int *ptr: The int being pointed to cannot be modified, but the pointer itself can.
int const *ptr: Same as above. The order of these things don't matter.
int *const ptr: The pointer itself cannot be modified, but the pointed to int can.
const int *const ptr: Neither can be modified.
>>
A bit of a noob question, but I'm new to programming.
Why would you make a void function or method? I know that it returns nothing, but what's the point of it then?
>>
>>58986077
For the side effects that the function has.
>>
>>58986051
>>58986061
thanks
>>
>>58986083
Can you show me an example with some code please?
>>
>>58986110
The print function in a language for instance. If doesn't return anything, but it prints something to the console.
>>
>>58986110
A simple example would be any printing function.
printf("Hello world!\n");

(Technically printf returns an int, with the number of characters printed, but that is ignored 99.9% of the time and treated like a void function)
>>
>>58986077
In Haskell and other pure languages, your intuition is correct and functions that return () (unit, the equivalent of C's void) are basically useless.
>>
>>58981996
Same, except vim instead of nano
>>
>>58986133
That's because Haskell is inherently useless at a fundamental level.
>>
>>58986110
void printIsARetard(char* anon) {
printf("%s is a stupid fucking retarded bitch\n", anon);
}

int main() {
printIsARetard("OP");
}
>>
>>58986151
What a complete waste of time.
>>
>>58986160
what do you mean?
>>
>>58983068
Why would you do this anyway?
>>
>>58986168
It doesn't even compile!
>>
>>58986192
FACT: 99% of programs ever written do not compile.
>>
>>58986122
>>58986130
So you make a void function that takes two numbers and makes num1^num2, and adds the new number to an array, you wouldn't use it for that? I'm still confused why you would create one yourself.
>>
>>58986179
So you can pass function pointers around, such as arguments to functions?
>>
>>58986179
Callbacks?
>>
>>58986200
>you wouldn't use it for that?
You can create a void which modified its arguments via pointers. That is considered a side effect of the function.
void swap(int *a, int *b)
{
int tmp = *a;
*a = *b;
*b = tmp;
}
>>
>>58986200
Are you retarded? Can you not read?
>>
>>58986204
it's covered in most introductions to C
>>
>>58985450
Diaspora
>>
macht mal neu
>>
>>58986235
>no return statement
This ain't C++ you fag.
>>
>>58986192
#include <stdio.h>

void printIsARetard(char* anon) {
printf("%s is a stupid fucking retarded bitch\n", anon);
}

int main() {
printIsARetard(">>58986192");
}

There you go anon.
>>
>>58986235
int main(int argc,char **argv)
{
if (argc == 2) printf("%s is a retard",argv[1]);
return 0;
}
>>
>>58986241
geh weg
>>
>>58986221
>>58986222
So you can pass arguments to it and then print the result anyway? Why use return then? Instead of return you just make it print to console.
>>
>>58986295
What?
>>
>>58986295
Negro, please.

It's clear you're at some early stage in the game where you haven't seen enough code to ask intelligent questions.

Go read a bit more so you can form you own opinion on the matter.
>>
>>58986253
In C99 and above main implicitly returns 0.
>>58986262
The whole point was to illustrate void functions, therefore code reusability
#include <stdio.h>

void printIsARetard(char* anon) {
printf("%s is a stupid fucking retarded bitch\n", anon);
}

int main() {
printIsARetard("OP");
printIsARetard("(You)");
printIsARetard("Probably Everyone on this board")
}
>>
>>58986295
fuck this, join irc #thisidiotdoesntgetit on freenode and I'll answer most of your questions as now it'sw just littering the thread with garbage
>>
>>58986340
We're past the bump limit anyway, so it doesn't really matter.
>>
>>58986295
>why use void functions?
>anons answer
>why use return then?
what the fuck is your problem?
>>
New thread:
>>58986356
>>58986356
>>58986356
>>
>>58986305
>>58986320
>>58986340
Example

static int a(int 1, int2)
result = 1 + 2;
return result;

void b(int 1, int 2)
Console.WriteLine("Result is" +(1 +2));


Main
Console.Write(a(3,4));

b(3,4);

Syntax isnt perfect, but im on my phone
>>
>>58985637
CLOS+MOP+whatever libraries you need gets quite comfy

>>58985786
(first (slot-value me 'niggers)) 
Thread posts: 327
Thread images: 30


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.