[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: 25
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>54479913

What are you working on, /g/?
>>
File: palantir.png?w=738.png (20 KB, 738x415) Image search: [Google]
palantir.png?w=738.png
20 KB, 738x415
>>54484471
I'm working with Palantir on an app that will track Internet pedophiles.
>>
>
if (Enumerable.Range(1,100).Contains(x))


Csharts everyone
>>
>>54484471
Kill yourself, you fucking degenerate.
>>
Trying to figure out how best to make an AST representation with binding like this:
data Exp a
= Var a
| Lam (Exp (Maybe a))
| App (Exp a) (Exp a)

and this:
data Exp' a
= Var' a
| Lam' (Exp (Maybe (Exp a))
| App' (Exp a) (Exp a)

work together, specifically in my type checking/inference step that also normalizes the well-typed terms. The first representation isn't ambiguous, but the second can make capture-avoiding substitution much more efficient.
>>
>>54484541
I guess one solution would be to not even bother with the unambiguous representation in the first place...
>>
>>54484541
What are you doing? Writing a Haskell interpreter?

Anyway you have just discovered why homoiconicity is good.
>>
>>54484497
>track
If you know who they are why aren't you reporting them to the police? Is it track or find?
>>
>>54484632
I build analytics and behavioral analysis systems based on massive intersecting datasets, then what people actually do or don't do with the data is above my paygrade.
>>
>>54484604
Not at all, it's part of a language implementation just using Haskell.

Not sure what homoiconicity has to do with this, either, it's just a normal AST.
>>
>>54484604
>>54484678
Unless by bringing up homoiconicity you're referring to HOAS. That's something else I'd consider doing. Just kind of annoying, since I wouldn't be able to combine the type checking and normalization step. Maybe that's not so bad. Though doing quotation for definitional equality checking/program extraction can be a tricky matter.
>>
>>54484497
I hope you die.
>>
>>54484710
ok pedofag
>>
>>54484710
Kek, feeling targeted in particular?
>>
>>54484471
I want to suck off Hime until his balls are completely drained
>>
>>54484664
Oh that sounds like an awful job, not knowing what you do or the big picture. My condolences.

>>54484678
Homiconic languages are trivial to convert into AST's. That's all I mean.

But what do you mean by language implementation? Are you writing a DSL? What's the goal?
>>
>>54484728
First they came for the pedos, and I did not speak out—
Because I was not a pedos.
Then they came for the hack3rs, and I did not speak out—
Because I was not a hack3r.
Then they came for the 4chan anons, and I did not speak out—
Because I was not a 4chan anon.
Then they came for me—and there was no one left to speak for me.
>>
>>54484777
Stop false flagging pedo.
>>
>>54484761
>Oh that sounds like an awful job, not knowing what you do or the big picture. My condolences.
It's a pretty fullfilling job, the problems are challenging, my team is super talented, and unlike most hipster startup here you can actually believe when they tell you you're making a positive change in the world.
>>
>>54484784
kill yourself
>>
>>54484761
Not a DSL, a fully-fledged language. I've mentioned it a few months ago, but gotten back into it now.
>dependent types
>linear types
>observational equality
>indexed inductive-recursive data types
>quotient types (0-truncated higher inductive types)
>compiled
>memory management, FFI, no GC, etc.
I'm hammering out the core language right now, which is basically just the soundness checks (type checking, linearity checking, totality checking) and the ASTs before and after.
>>
>>54484464
>I'm much more interested in creating a tamagochi-style game but with much more complex 3d creature that is able to learn and communicate with you.
Ever play the Sonic Adventure games? The AI was pretty primitive, but chao were fun as fuck to play with.
>>
>>54484823
ah i remember you, glad to see you're still working on the project :3
>>
>>54484795
no u
>>
>>54484823
How is it compiled? Straight to assembly or are you going to use an intermediary language like C?
>>
>>54484823
So basically another meme?
>>
>>54484852
Yes, I was a bit starstruck when Vulkan came out and got into an obsession with it for a while. Back to this now that the novelty's worn off.

>>54484907
Haven't decided yet. Probably through LLVM, although the architecture of it all is conducive to multiple front ends/back ends.

>>54484917
Sure, I guess so.
>>
I'm making the decision to install GHC on my computer to see what all the hype is about. Anyone got some recommended learning resources?
>>
>>54484835
Nope, but I will try. Thanks, anon.

My prime examples of good game AI (you could call it ALIFE) are Creatures http://www.sci.brooklyn.cuny.edu/~sklar/teaching/f05/alife/notes/ali-Creatures4.pdf and Black & White.
>>
>>54485024
http://www.haskellbook.com/
http://dev.stephendiehl.com/hask/
>>
>>54485038
Your first link is a 60 fucking dollar book jesus christ.

Your second link is a page that doesn't render even remotely correctly.
>>
>>54484471
When I define a C++ class in another class, and I need to use that class in a different class, can I include the class I need as a .cpp file or do I have to make the class definition as a header file?
>>
>>54485120
The whole point in defining an inner class is to encapsulate it. If you want to use a class wherever you please, you need to define it globally (or in a namespace).
>>
>>54484823
I doubt these complex type systems really pay off in the end. Looks like a fine pastime, puzzle-oriented programming to me.

I would be much more interested in a "wide-spectrum language" - a dynamic, functional, object oriented language with good profiling tools and an easy way of providing low-level type information for hot blocks of code. Possibly even with smart editor that tells you where the runtime has it hardest with optimizing your program.

But ofc it won't happen because there are already inferior versions of such systems (common lisp - type annotations, dynamic, powerful compiler; javascript - dynamic, powerful compiler, asm.js for typing;)
>>
>>54485135
So can I use
#include "Class.cpp"


or

Class.h


The CPP file has a bunch of functions in it.
>>
>>54485038
Are you using IE6?
>>
>>54485161
>#include "Class.cpp"
You include the header file.

And what you said earlier made me think you did
class a {
class b {
};
};

If you do that then b is invisible to everything except what's inside class a.

Anyways it, since it sounds like you're a n00b, don't start with C++. It's better to C first. C++ is essentially a more complicated C with a bunch of other shit piled on top.
>>
File: 1439903195165.png (536 KB, 776x840) Image search: [Google]
1439903195165.png
536 KB, 776x840
Imagine you receive an android body by mail.

It has a 48 Degree-Of-Freedom body with 12 hrs of battery life (avg physical activity) with all necessary sensors (eye CMOS cameras, microphones, gyro/accel, tactile sensors, speech dynamic) and 10-core ARM CPU inside (there is a wifi as well, so offloading computation to the cloud is possible), and a microcontroller for precise motion control linked to main CPU.

You have a full access to software and firmware, you can use standard dev tools (compilers, runtimes) and OSes for main CPU and the microcontroller.

How would you program it?
Which approaches/methods/algorithms would you use?
Which software would you use?
What are the main technical problems in this project?
>>
>>54485159
Whenever I use a super powerful type system like that, I always feel like I'm simply shifting a lot of my effort into the types, and the rest of the program (aside from interesting logic) basically falls into place by itself. Which is nice, because types allow me to both reify my thoughts as comments, but also have them checked over by the machine.

But yeah, it is almost like a puzzle, the same way that working out proofs is a puzzle (because it's practically the same thing). It can be a pastime but it can also be very productive.
>>
>>54485238
I would first look up the research done by Boston Dynamics, because these people are at the cutting edge of natural-looking robotic motion, and a robot that moves like a handicapped tetraplegic is just depressing.

Then I would consider what is it that I really want out of this android? Do I want a helper? Do I want a curiosity? Do I want a semi-autonomous AI?

Those lead to very different directions, and in the case of the AI most likely I wouldn't be able to have it reach its full potential alone, so I would probably either join or start a project bigger than just me.
>>
>>54485265
I'm much more interested in algorithms and numeric math, the programming part has been always the easiest for me. Well, good luck with your project, anon!
>>
>>54485316
That's a nice start!
>I would first look up the research done by Boston Dynamics
They use modified ZMP algorithm.

> and a robot that moves like a handicapped tetraplegic is just depressing.
This looks good enough for me https://www.youtube.com/watch?v=YvbAqw0sk6M

>Then I would consider what is it that I really want out of this android? Do I want a helper? Do I want a curiosity? Do I want a semi-autonomous AI?

Hmm, I would order my priorities like this:

* Curiosity (easiest to do - just basic walking talking and listening)
* Helper (much harder, should be able to execute basic tasks in semi-structured home environment)
* Do I want a semi-autonomous AI (even harder - should do all previous and also learn new skills in supervised and unsupervised way).
>>
studying for an interview next week

any favorites /g/?
>>
File: newsmug.png (545 KB, 729x569) Image search: [Google]
newsmug.png
545 KB, 729x569
Working on learning bash.

>Want to prompt a user (Y/N) in a script
>Startpage
>https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
>mfw when the stackoverflow copypaste meme is real
>>
>>54485514
I went into my first (ever) interview for an internship a couple weeks ago, completely relaxed without having studied anything but with a kickass github account and CV.
It went really well, the nerds interviewing me were practically more stressed than I was, I even negociated the salary and ended up getting paid 3-4x more than my peers.

So my advice is, you already know your shit, just be confident.
Ask them plenty of questions to make sure they aren't a shit workplace, and if *they* do a good interview, accept their offer.
>>
>>54485111
>>54485177
looks fine in both Firefox and Chromium for me
also
anyways, some other helpful resources:
https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours - works as a good first project as well as a way to learn
>>
>>54485567
that's the attitude!

this is my first post-college-job interview so while i feel pretty good in my skills, i'm not so sure how the interview scope changes as the experience grow.

that said my job is fine so i'm pretty relaxed about it, if i don't get it, it doesn't mater.
>>
>>54485616
fuck i hit post early
meant to paste:
http://dev.stephendiehl.com/fun/WYAH.pdf - more advanced thing similar to the Write Yourself a Scheme tutorial
https://shodan.me/books/Programming/Haskell/ - i'd say to avoid LYAH because it was honestly more confusing while learning
>>
>>54485561
Was trying to work out where the fuck $REPLY came from, turns out that's what read uses if you don't name a field.

Fucking hell, for a snippet so simple you'd think people would make stuff like that a little more obvious.
>>
>>54485024
thinking functionally with haskell
>>
Hey /g/, I just got a job offer for a .NET position. I told them I knew all about ASP.NET and C# and LINQ. I lied. I start Monday. How fucked am I?
>>
>>54486216
fucked
>>
>>54486226
Is it hard to learn that shit in a week? I hardly even know what MVC is
>>
>>54486265
good luck
>>
All I want to do is make 3d graphics on linux and I tried for the past 8 hours to get 3 different programs and I can't even get the most basic tutorial to fucking work for any of them.

I just want to program but I have to use all these fucking god awful tools with beginning instructions that never fucking work.

>Oh just copy paste this and type this into the terminal!
No you fucking autist that obviously doesn't work because now the compiler is telling me the file I copy pasted is missing a ; on line 9001, and then when I google it the answer on stack overflow has some fucker named rajeet saying thank you to a guy who privately messaged him the fix.

How the fuck am I supposed to learn any of this crap?
>>
>>54486272
>All I want to do is make 3d graphics on linux
>basic tutorial
You are literally fucking retarded. Learn a language from some book and then read an OpenGL book that uses that language, which is most likely C++.
It'll probably take a year if you're as retarded as you sound.
>>
>>54486304
the most basic aspect of the program I am trying to use you nigger.
>>
>>54486304
Also I am complaining about simply running the premade tutorial files made by someone else, not even coding, just getting the fucking tools to work.
>>
>>54486320
have fun getting nowhere
>>
>>54486320
learnopengl.com
>>
File: 14629292500221169338599.jpg (3 MB, 5312x2988) Image search: [Google]
14629292500221169338599.jpg
3 MB, 5312x2988
Installing CentOS 7 on my work laptop, listening to take on me (Pandora) and about to start watching haryana Potter while I configure my stuffs.
>>
>>54486365
I don't want to use OpenGL I want to use someone else's engine so I can do what I am trying to do as fast as possible.
>>
>>54486385
ogre3d.
lrn2google faggot
>>
File: wtf.png (114 KB, 1707x775) Image search: [Google]
wtf.png
114 KB, 1707x775
>>54486410
>>54486272
Guess what program I've been repeating instructions over and over again trying to get fucking working.
>>
>>54486433
>error: expected ";"
well someone is a dumbass
>>
https://www.youtube.com/watch?v=XrFegNHpHfc
is asmr dpt approved?
>>
>>54486458
Look at line 74 and tell me where the ; goes.

Also I didn't write it you mong, this is code I downloaded from the fucking tutorial for just configuring a project.
>>
Can someone make a bubble sorting program in matlab for me?
>>
>>54486485
I've gone over all the instructions on their wiki literally 10 times and it keeps fucking up, I've been at this for hours.

Over the last 4 years I've tried configuring ogre 5 times and every time I just end up with a bunch of garbage files on my computer because it will never even compile.
>>
>>54486433
Your problem is
>error: 'Overlaysystem' in namespace 'Ogre' does not name a type
I think you're not linking or including correctly.

Typically when using C++ compilers, the first error is meaningful and as the compiler continues to be confused, it throws up errors onto the output.
>>
>>54486464
This is some weird fetish shit.
>>
>>54486539
I think I have some sort of mix up with the software version of this, but the way packages work is really confusing to me still, I have ogre installed on my computer and have downloaded all this shit, and it doesn't help the tutorials on this supposedly "well documented" program feel like multiple people are just ripping it apart shoehorning in all these updates and asides they want you to look at that really don't have anything to do with anything....

I'm tempted to reinstall my OS at this point.
>>
File: 14555622836.jpg (181 KB, 1031x965) Image search: [Google]
14555622836.jpg
181 KB, 1031x965
>that guy who pronounces "char" like "care"

what's his story?
>>
>>54486634
>There are people who pronounce it like "char" as in "charcoal"
>>
>>54486634
kernighan pronounces it "care" and since he learned C from dennis ritchie, i can only assume ritchie pronounced it "care" too.
>>
>>54486634
>Not pronouncing "char" as "car"
What are you, a savage?
>>
>>54486634
They think it's char as in chiral.
>>
>>54486634
https://www.youtube.com/watch?v=de2Hsvxaf8M&t=2m35s
>>
I'm still learning to code so i spend most of my time on coding sites anyone want to help me break down this problem?

You and your friends like to party but all the party spots are across the bridge from where you guys live. The bridge is quite old and unsafe, so only two people at a time can cross it and they need a lamp to do so at night. Unfortunately, your group only has one lamp.

This particular night is very cold, so you want everyone to cross the bridge as fast as possible. For the ith person in your group you know the time ti it will take them to cross the bridge. When two people i and j cross the bridge, they walk at the speed of the slowest of them, so it would take max(ti, tj) to get to the other side.

Calculate the minimal time your group will need to cross the bridge.

Example

For t = [1, 2, 5, 10], the output should be
Bridge(t) = 17.
I'm working in java not looking for answers just ways to break it down I can't seem to wrap my head around this one :/
>>
>>54486743
he's so surprisingly lively and full of energy
>>
>>54486798
>who is carrying the lamp?
>after 2 people pass, how does the lamp get back?
From here it should be obvious. But your example is wrong, if that format is an array of each person's time to cross the bridge, then it should take 19 minutes.
>>
>>54486634
so like CHARacter?
>>
File: heather-brooke.jpg (42 KB, 500x502) Image search: [Google]
heather-brooke.jpg
42 KB, 500x502
Working with Java here,

Anyone familiar with
>lazy loading (for example, Facebook displaying more content after you scroll down)
>clicking web buttons from Java app
>HTML Unit

Is it possible to lazy load a web page from a Java app to show more content?
>>
>>54484788
Are you? Just where does the line lie in your code? Are they all truly pedophiles or are you tagging weeaboos who look at pictures of cartoon girls that might be considered "underage"?
>>
>>54486937
onScroll events in client side js + a RESTful API that supports paging. jQuery makes this pretty easy.
>>
>>54487014
Are there examples anywhere that demonstrate this?
>>
>>54486907
>>54486798
Just want to append that obviously you shouldn't take my word for it, and if you agree with me that the example is wrong, email the prof saying "I'm not sure how you come up with 17, best I got is 19." Bonus is they'll probably explain to you how you do the algorithm.
>>
>>54486272
>All I want to do is make 3d graphics on linux
The bare minimum requirements to do 3d:
-know math
-have an api to get a window on the screen and to set pixels.

There is a guy on youtube(thebennybox) who has made a series of videos on software rasterization. I would still strongly recommend reading a few math books before jumping into 3d tutorials.
>>
>>54486272
Rather than learning fucking ogre, which I've had trouble with, just learn opengl. I recommend NeHe's tutorials. You'll have to replace the win32 api bits with something else, like sdl.
>http://nehe.gamedev.net/tutorial/lessons_01__05/22004/
>http://lazyfoo.net/tutorials/SDL/50_SDL_and_opengl_2/index.php
>>
File: Man_vs_Machine.gif (2 MB, 436x376) Image search: [Google]
Man_vs_Machine.gif
2 MB, 436x376
working on starting a machine learning/data science general.

is it pointless? is it futile? how do generals get started? what does it mean, to be a man? am I merely a chemical machine?
>>
how in the god damn fucking shit do I get python to format the output of an sqlite3 select and not be fucking ugly as shit?

the output is
('test',)

WHY CAN'T IT JUST BE 'TEST' LIKE EVERY OTHER LANGUAGE?
>>
>>54484497
Thought about applying for a palantir internship.
Probably hard to get though.
>>
>>54486216

Well, you've got a little less than a week to learn all of .NET. Better put on training montage music. No anime or vidya until you can program C# as well as your favorite programming language.
>>
say I wanted to open mpc with arg myfile. What better way is there than
system("mpc myfile")

since system is so evil. In what way is this alternative better than system since in this case mpc is a trusted program.
>>
>>54487173
https://www.youtube.com/watch?v=sxDyXK93o6g
>>
>>54487334
https://www.youtube.com/watch?v=xeYfK9NQyoo
>>
>>54487308
exec section of calls.
>>
>>54486265

You dont know what MVC is?

And you dont even know ASP.NET webforms, or LINQ?

Yeah youre pretty fucked kiddo. Go to pluralsight and look up scott allens stuff.
>>
>>54486743
i wonder how much cancer he got hearing the computerphile guy ask his question
>>
/dpt/, how much do you take reference from your previous programs?

Let's say there's an algorithm that you wrote for a program previously, you thought it out and wrote it from scratch

If another program needs a similar/equal algorithm, do you think from scratch again or do you use your old program as a reference?
>>
>>54487544
No shit you copy it. Unless of course it's illegal because you don't own the previous code you've written.
>>
>>54487544
If you are on a crunch for time, just refer to your other algorithm. But I guarantee you can write it better than you did before.
>>
>>54487202
str(yourvariable[0])
>>
>>54487544
just copy it dude lmao
>>
>>54487565
If it works why would you rewrite it? That's fucking stupid. Who cares if you can write it better this time? If it works it works, and if you need it to be better, you can copy it and improve it.

Half the fucking features of programming languages are there to make copying easier. Functions, classes, inheritance, templates, etc.
>>
File: 1384242627302.png (7 KB, 300x300) Image search: [Google]
1384242627302.png
7 KB, 300x300
>>54486798

This algorithm is right off the top of my head, so it may be fucked but it might be a step in the right direction

1. Load people into array
2. Sort array
3. Take person with lowest time (startOfArray) and person with longest time (endOfArray)
4. assign lamp to person with lowest time (quickest person)
5. Cross bridge (compare hasLamp i to person crossing j, obviously the quicker person should have the lamp).
6. Compute average t for i + j / 2
7. add result to i (to account for hasLamp crossing back
8. Repeat until array is empty.
>>
>>54487640

annendum: obviously i does not have to cross back the final time to retrieve someone, following that algorithm to a tee will result in i going back when theres nobody left, then getting removed from the array, which is incorrect
>>
>>54487544
a ton.
Especially if it is graphics stuff... So much boilerplate that you can really write once and then just re-use with minimal updates/modifications later.
>>
>>54487612

>Why would you rewrite it
If it needs slightly different parameters, or if it's in a different language, you would rewrite it.

The other day, when since Anon posted a challenge to "do multiplication in Java without the * operator", I wrote an add and shift implementation using an existing ruby implementation of square and multiply exponentiation as reference.
>>
>>54487695
When an Anon*

Swype is shit, but I'm a shitty typer on my phone without it.
>>
>>54487695
>key phrase: if it works
>>
>>54487640

also im dumb and didnt read the entire post correctly, they dont walk at the average of the two, they walk at the slowest speed. So just replace i + j / 2in step 6 with just i + j (slowest speed to cross, plus i returning to the other side).


Also your professors example is correct. Taking a summation of the maximum of those subsets you result in

max[1,2] = 2 + 1 = 3
max[1,5]= 5 +1 = 6 + 3 = 9
max[1,10] = 10 + 1 = 11 + 6 = 17

I believe this is following Euclids GCD formula.
>>
>>54487515
He likes to give pretty much the same talk wherever he goes because he gets asked the same questions over and over.
>>
>>54487784
What no he isn't, unless I misunderstand:
>1 & 10 walk together ; 10
>1 walks back ; 11
>1 & 5 walks together ;16
>1 walks back ; 17
>1 & 2 walk together ; 19
>>
>>54487883
This is correct. It should be 19. The fastest person would just have to return after each of the slowest people with the lamp.
>>
>>54487883

Professor might be dumb then. Logically it is 19 but I can see how they get 17 implementing GCD algorithm, which if you're in school is something taught a lot because its useful as fuck (thats the only reason I considered it). Did he tell you it could be incorrect? You might want to take another prof in the future...
>>
>>54487929
>>54488003
>>54487883

Nope, figured it out.

[1,2] = 2
1 returns = 3
[5,10] = 10
2 returns = 15
[1,2] = 17
>>
>>54488147
I went step by step explicitly. What was suboptimal in >>54487883
>>
>>54484471

Why does line 22 (cards.toString();) in CardDriver.cpp crash the program?

CardDriver.cpp
// Card shuffling and dealing program.
#include "Card.h" // Card class definition.
#include "DeckOfCards.h" // DeckOfCards class definition
#include <iostream>
#include <vector>

using namespace std;

int main()
{

Card cards(13, 4);
cout << "Creating the deck of cards.\n" << endl;
DeckOfCards deckOfCards; // create DeckOfCards object
cout << "Shuffling the deck of cards.\n" << endl;
deckOfCards.shuffleCards(); // shuffle the cards in the deck
cout << "Dealing the deck of cards.\n" << endl;
deckOfCards.dealCard();// deal the cards in the deck
cout << "Checking if there are more cards.\n" << endl;
deckOfCards.moreCards(); // Checks if there are any cards left.
cout << "Printing the dealt hand." << endl;
cards.toString(); // This line crashes the program.

//cin.get();
return 0; // indicates successful termination
} // end main


Card.h
#ifndef CARD_H_INCLUDED
#define CARD_H_INCLUDED
#include <iostream>
#include <string>

class Card
{
public:
Card(int, int);
std::string toString();
private:
int face;
int suit;
std::string static faceNames[13]; // array of card face values
std::string static suitNames[4]; // array of card suits
};

#endif // CARD_H_INCLUDED


Card.cpp
#include <iostream>
#include <string>
#include "Card.h"

using namespace std;

// initialize Card arrays
string Card::faceNames[] = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"};
string Card::suitNames[] = {"Clubs", "Diamonds", "Hearts", "Spades"};

// returns a string representation of a Card

string Card::toString()
{
// strings can be concatenated with +
return faceNames[ face ] + " of " + suitNames[ suit ];

} // end function toString


Card::Card(int f, int s)
{

face = f;

suit = s;


}

>>
Would learning a functional language be of any benefit?
>>
>>54488200

You want a summation of maxima, so if you take, for example, 1 and 8 and result in 8, plus 2 and 10 and result in 10, the average of those two is 9. This is different than if you took, for example, 8 and 10, resulting in 10 and 1 and 2, resulting in an average of 6. Make sense?

Actually pretty clever if you ask me, I take back your prof being dumb. This is very very applicable to CS.

Basically if a objects load in memory, you want some kind of efficient loading for size k. It wouldnt make sense to pair your shortest access time perpetually with your longest access times, as that would increase your overall access time average. A much more efficient algorithm would take the average of your highest set and your lowest set, since they would result in a lower average access time.
>>
>>54488348
Arrays start at 0. cards(13 means you're accessing out of bounds. If you want "King" you must write 12.
>>
>>54488371
Thanks. I always make that mistake.
>>
>>54488444
Don't worry. You are not the first one.

Get it?
>>
>>54488474
genuine kek
>>
>>54488365

t. https://www.cs.auckland.ac.nz/research/groups/CDMTCS/researchreports/161CE.pdf
>>
Anyone use splint? Running
splint *.c

in my project directory outputs
/usr/include/ctype.h:46:5: Parse Error: Non-function declaration:
__BEGIN_DECLS : int. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.

Even if I try
splint *c +unixlib +posixlib

like the manual suggests, it still has the same error.
>>
File: ss+(2016-05-11+at+01.09.05).png (11 KB, 619x75) Image search: [Google]
ss+(2016-05-11+at+01.09.05).png
11 KB, 619x75
>have final due in about 24 hours
>have to use JavaFX among other things to make a contact manager with a GUI
>professor didn't even cover the chunk of info needed to get it done
How the fuck do I approach this?
>>
>>54485623
>>54485567
Man, I've been applying places. I'm super nervous about getting some ridiculous question about data structures. And being put on the spot about it. Don't wanna choke.
>>
>>54489198
Ah. Your final is about you learning how to use Google.
>>
>>54489351
Hey anon. I just got an offer today after 6 months of applying. Anyway, I did about 8 or 9 interviews and only one asked how I implement a linked list in C, which is very easy anyway (might wanna look that up)
>>
Working on Unix system administration, which naturally includes C, sh, csh, sed, awk, and more.
>>
File: textboard4.png (43 KB, 1919x953) Image search: [Google]
textboard4.png
43 KB, 1919x953
Just working on this textboard again. I just got greentext working which took waaay longer than it should've.

>>54487544
It really depends, but it happens quite often. For instance, the SQL query to get the most recent 3 replies to a thread in the right order (so they can be shown on the front page) was largely taken from an Android app I wrote a while back.
>>
>>54489370
Oh that's not bad at all. I can whip up some linked lists in C. But something like, create a balanced search tree, right now. Which I can do but that'd take me a good bit. I know how to create stacks/queues, linked lists and BSTs but it's the out of nowhere stuff that I'm afraid I'll be asked.

>tfw applying to every internship that looks like it's CS/software related
>only one has emailed me back so far
Future looks great. I applied for a one or two last summer but didn't get them. Now I'm trying to get out there a lot more. Hopefully they won't pick up on my autism.
>>
knowing C# and Java Pajeet edition, also all the /wdg/ meme langs (read javascript and its mongrels ) wanting to get into C++

Whats the best online materials for free or nice books (I could buy them no need to be free) that are good material for somewhat experienced guy ? (the main reason for getting into it - there is a handful of local jobs that are 150k starting for C++ devs, and it seems fun )
>>
>>54489512
Learn machine learning
>>
>>54489512
The C++ Programming Language (newest edition obviously) as your reference
and Modern Effective C++
>>
>>54489198
we didn't even cover C# or .NET, we had to learn it ourselves (this was after being taught java and C++ units)
>>
>>54488716
damn man
why must they use C and not haskell for this
>>
>>54489696
Because you live in a Unix world.
>>
Can C# be ported over to linux somehow?
>>
>>54489892

It already has been.

https://github.com/dotnet/coreclr/

.NET code is like Java code -- write once, run everywhere.
>>
>>54489904
>Java
Write once, run on Windows, Mac OS X, GNU/Linux, and Solaris. Four operating systems is not "everywhere".
>>
>>54489941
Except for the fact that every JRE is different and breaks different things.
Java is cancer and it should die.
>>
>>54489904
dumb tripfag
>>
>>54489948
I fully agree.
The JRE is worse than the language itself, though. If the language was compiled to an ELF, things would be a lot better.
>>
#include <stdio.h>
#define T 10
int main () {
int x[T], y[T], z[T], i, j, k,l=0;

printf("Type the first list of 10 numbers:\n");
for (i=0; i<T; i++) {
scanf("%d", &x[i]);
}
printf("Type the second list of 10 numbers:\n");
for (j=0; j<T; j++) {
scanf("%d", &y[j]);
}
for(i=0;i<T; i++){
for(j=0;j<T;j++){
if(x[i]==y[j]){
for(k=0;k<=l;k++){
if(z[k]!=x[i]){
z[l]=x[i];
}
}
l+=1;
}
}
}
printf("The repetitive numbers are: \n");
for(k=0;k<l;k++){
printf("%d ", z[k]);
}
return 0;
}



/g/, please, help me to display only the numbers that are repeated from the list one and two using vector as result? The vector result doesn't need to show duplicate values.
>>
>>54490012
The JVM (I assume that's what you mean) is the best part of Java.
>>
>>54490012

>If the language was compiled to an ELF
Now... just because something is using a format typically used for native code does not mean that the code inside that file is actually executable. .NET uses the PE file format, which is the same as normal native Windows executables. The entry point for the executables, however, is stored in an external DLL, thus allowing one to avoid calling a secondary command when running .NET executables on Windows (the NT kernel doesn't even know what .NET is. mscoree.dll is doing all the work). A similar approach could just as easily be used in the ELF file format if one wanted. It wouldn't make Java any faster.
>>
>>54490102
[[citation needed]]
>>
>>54490138

Does not mean that the code inside that file is actually native*. Derped there... although one could argue that IL code isn't actually executable.
>>
>>54490056
sorting them can help
>>
>>54486798
Brute force it.
>>
>>54490158
I see.
>>
>>54490191
How? I spend many hours to resolve that.
>>
>>54490056
Just AND it noob.
>>
>>54490206
Insertion sort is simple and one of the fastest for very small inputs.
>>
>>54487544
Personally I have a dir with all the autotools stuff set up with placeholder values so when I start a new project I just cp -r autotools/* . and then make minor changes.
I feel pretty bad for doing it, but let's be honest nobody remembers all that inconsistent m4 syntax and shit.
>>
How do i compare all the elements against each other in an array? I have an array of objects that have a starting time and an ending time (intervals) and i need to check if any of the intervals overlap. I wrote the function to check if they overlap but no idea how to check every element against every element in the same array.
>>
>>54490594
Doing this in ruby btw
>>
>>54490594
You can check if two dates overlap by using a pretty simple expression:

http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap

You should be able to figure out how to compare every element to every other.
>>
So if I write a client and a server based upon TCP that both encode/decode their packets in Big Endian, do I still need to worry whether the host machine uses BE or LE or it's gonna work just fine?
>>
>>54490672

This is a solved problem.

http://linux.die.net/man/3/htonl
>>
>>54490672

I believe that the host must use BE if you use BE. I am not 100% on that though.
>>
>>54489941
>implying
Things like http://www.ni.com/compactrio/applications/ have the ability to run Java.
>>
>>54485561
>learning bash
Remember to use the safe flags, it will save you time debugging
http://boilerplatecodes.com/shell/bash-strict-mode
>>
>>54486937
Try the jHipster framework.

As much as I **HATE** the branding, it's pretty fucking useful.
>>
>>54489402
>mfw I have the skills and experience to code my own imageboard in a weekend but zero motivation to do work if I'm not told to by a boss
>mfw shut-in fatsos in a bangladese footwear appreciation internet forum have more fulfilling hobbies than I could ever dream of
>>
>>54491167
When I had ideas, I didn't have the expertise
Now that I have the expertise, I don't have time
When I do have the time, I just don't want to be in front of a monitor anymore
>>
>>54491060
the branding sounds about right for webfaggotry
>>
>>54491167
Guy you replied to here.

It's not that fulfilling, it's just better than any alternative option I have.
>>
>>54491231
it does.
at least they're honest about it.

All in all it's one of the nicer frameworks.
>>
I'll just leave this here...

https://youtu.be/8YP_nOCO-4Q
>>
Can someone give me an ass-simple problem to code in C?
I haven't programmed for months, and amn't even able to set a pointer. Maybe something that'll force me to learn pointers? Idk

thanks bois
>>
>>54491330
Reverse a string, only with pointers.
>>
>>54491330
Order a red/black tree
>>
Trying to improve my shell scripts lulz. Yeah, I'm THAT guy... I should probably start using Python more.
>>
has anyone ever tried to use NN for game AI? like they are pre-trained and maybe also learn in their interactions with the player
>>
Who works with Qt here? To be more specific, I'm looking for advice on how to set up and organize stylesheets for my widgets. I looked up Telegram's source and it looks like they store plain stylesheets in files and load them up at runtime. Is it the best approach? Right now I just hardcoded them but it kinda sucks.
>>
>>54491358
with or without knowing its length?
>>
>>54491694
You know you can compute the length if it's valid ?

char *strrev(char *s);


Implement this function, should reverse the string in-place and return a pointer to the first char of the result (aka, the original value)
>>
>>54491694
It's more interesting if without. Assume it's a null terminated string.
>>
File: DSC_0511.jpg (3 MB, 2160x3840) Image search: [Google]
DSC_0511.jpg
3 MB, 2160x3840
I took a new OP picture for DPTs. It should sum up most old time /g/ users I think.
>>
>>54491720
Nice ethlyphenidate.
>>
>>54491720
The premise is good but the execution could be better.

The composition is poor with the edge of the table being barely visible and the book being slightly crooked. Better composition would be either to have the book at a 45 degree angle hanging 30%-40% off the table, with the powdered sugar and straw close to the corner furthest from the table edge.
>>
I just finished a DNS monitoring script for our anycast nameservers.
It checks if it can resolve two addresses, one from our own LDAP, and one from the upstream nameservers.
If both lookups fail, it wil withdraw the anycast route until it works again.
Errors are logged to syslog, and syslog is monitored centrally.
First server pair that has this is in production now, 4 more to go.
>>
>>54489402
Here's a link if anyone wants to play with it:

gitgood . esy . es
>>
>>54491401
There are no serious programmers here.
Just newfags lerning ilnked lists in C because /g/ told them to, and telling other newfags to learn C because /g/ told them so.

---
HalfLife2 had the idea of learning players' tactict and adapting to them / adapting game difficulty on the fly, but I don't think they ever released the details.
Normally NN need lots of computational power/iterations to get useful, so I'm not really sure it would work *on* the players machine.

There are probably workarounds, tho. I'm still not sure I'd reach for NN, tho.
>>
>>54491713
>if it's valid
a string is always valid
>>54491718
>Assume it's a null terminated string
there are no other kinds
>>
>>54492353
I bet you can't even average 2 ints.
>>
>>54492353
Could you possibly project any harder?
>>
>>54492372
(defn average [x y] ( / (+ x y) 2))

The result is a ratio.
>>
cout << (char)"a" + 1 << endl;

spoooooooooooooooooooky
>>
Any of you fucks do freelancing, if so, where? Gotta make some short term money.
>>
>>54492628
You're out of luck, you need either connections or have a solid portfolio to land a job.

Try fiverr, baka
>>
File: 1462969177.png (15 KB, 381x345) Image search: [Google]
1462969177.png
15 KB, 381x345
REGEX
why this does not work?
>>
File: otter.webm (2 MB, 640x640) Image search: [Google]
otter.webm
2 MB, 640x640
Ask your much beloved programming literate anything (IAMA).

>>54492628
https://www.upwork.com/

>>54492372
int average (const int x, const int y) 
{
if ((x > 0) == (y < 0))
return (x + y) / 2;
const int xh = x / 2;
const int yh = y / 2;
const int xhr = x % 2;
const int yhr = y % 2;
return xh + yh + (xhr & yhr);
}


>>54491720
>barely used
(¬‿¬ )

>>54489904
More like "write once, debug everywhere".
>>
>>54490594
Bumping this. Got one reply by someone who didn't read my question.
>>
File: 1462970254.png (23 KB, 755x445) Image search: [Google]
1462970254.png
23 KB, 755x445
>>54492704
got it... i needed multiline modified 'm'
>>
>>54492579
>you're right, I can't
Called it.
>>
>>54490056
here u go my dude:
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>

static constexpr unsigned int Size = 10;

template <typename F>
static void times(unsigned int n, F f)
{
while(n--)
f(n);
}

int main(int, const char **)
{
std::vector<unsigned int> a{}, b{};
a.reserve(Size); b.reserve(Size);

std::string tmp{};
times(Size, [&tmp, &a](unsigned int) {
std::cout << "Type a number for the first list: " << std::endl;
std::getline(std::cin, tmp);
a.push_back(std::stoi(tmp));
});

times(Size, [&tmp, &b](unsigned int) {
std::cout << "Type a number for the second list: " << std::endl;
std::getline(std::cin, tmp);
b.push_back(std::stoi(tmp));
});

std::cout << "Duplicates: " << std::endl;
times(Size, [&a, &b](unsigned int n) {
auto end = b.end();
if (std::find(b.begin(), end, a[n]) != end)
std::cout << a[n] << ' ';
});
std::cout << std::endl;
std::cout.flush();

return 0;
}
>>
>>54492849
>implementation defined shitty code
no thanks
>>
File: vomit.jpg (90 KB, 650x650) Image search: [Google]
vomit.jpg
90 KB, 650x650
>>54492932
>>
File: wOsEq7N.png (317 KB, 793x3106) Image search: [Google]
wOsEq7N.png
317 KB, 793x3106
>>54492935
>implementation defined
Where ?
>>
I'm rather new to python and been stuck for a while. would appreciate help.
I have a function which creates a list. this code is quite long and messy.
I want to create a new function, which will use this list. Can I do it in a neat way? I don't want to write the long messy code again in the new function.
I'll use a very simple example. In reality it's much messier, but I think the principle is the same:

def first():
a = [1,2,3]

def second():
a.append(4)
>>
>>54493043
def first():
a = [1,2,3]
return a

def second():
a = first()
a.append(4)
>>
>>54493016
where the standard says so
>>
>>54493016
this is a very cute infographic did you make it it's quite good
>>
>>54493075
thanx m8! saved me much time
>>
>>54492372
You can't even average the quality of the posts in these threads.
>>
File: tu2.png (127 KB, 700x2528) Image search: [Google]
tu2.png
127 KB, 700x2528
>>54493122
no.
>>
>>54489941
It doesn't even run on my main OS! I wrote it myself. The only system calls are malloc(), free(), and SIGKILL, and it only works on a specific architecture: an NES chip hooked up to a potato battery.
>>
File: im fed up with this world.gif (2 MB, 400x225) Image search: [Google]
im fed up with this world.gif
2 MB, 400x225
>>54491280
"If you're used to web apps, desktop apps have their own delightful gauntlet of hard parts"
>>
>>54490140
What do you consider the best part then?
>>
File: cover.png (371 KB, 1044x1294) Image search: [Google]
cover.png
371 KB, 1044x1294
Just bought this.
After one year of doing only ~java~ for school I want to have fun.
>>
>>54493728
Do some of the tasks, they're pretty nice.
Also, K&D error handling is incredibly nice.
>>
>>54493728
Enjoy your asswards syntax just for the fuck of being different, lack of generics, shitty error handling, large binaries and GC :)
>>
>>54493728
>go
>fun
lol cuck
>>
>>54494092
>programming
>fun
lol cuck
>>
>>54494103
things you're good at tend to be fun. but you wouldn't know that.
>>
>>54493825
large binaries (static linking) > dynamic shit linking
syntax is very minimal and nice (look at rust for the opposite)
if err is still a shiton better than try catch exceptions (swift does do error handling better however *and having options*)

Overall I would say Swift is better, but Go is the best for large scale development. Don't even need code reviews that much!

But for single user development where you are the only constant, F# is best
>>
File: choo_choo_bitches.gif (2 MB, 260x249) Image search: [Google]
choo_choo_bitches.gif
2 MB, 260x249
I need to keep learning python. Ive learned the basic language I did a intro to comp sci course with it and I use it at working to make up data for epa reports so I dont have to do it by hand.

I need to do another project though for practice. I have a freenas server in my closet and want to do a rss scraper/parser whatever on a freenas jail so I can get into curating my own news feed. I know beautifulsoup exists and would get it dont fast. But still I want to do it from the group up at least for a simple version just for the practice and so I understand what is under the hood when I inevitably use beautifulsoup for the actual thing I will keep.

But Id really like to find a tutorial or something maybe like bullet points to making a simple one myself to start off without that library that will do it all for me. Anyone know anything like that somewhere on the web?

Also what is the difference between rss reader scaper parser if any. Or any of the other terms for them I see when googling open source python rss reader.
>>
I'm making a turn based roguelike in PHP, enjoy some of my shitty river generation code, most of it was changed to allow for debugging.

        private function populateMap() {
while($this->treeCount >= 1) {
$this->map[rand(1,$this->mapheight)][rand(1,$this->mapwidth)] = 'O';
$this->treeCount--;
}

if ( $this->riverChance >= rand(1, 100) ) {

if ( $this->riverCurveChance >= rand(1, 100) ) {
$curve = TRUE;
$curvestart = rand(1, $this->mapheight);
}

$orgin = rand(0,3);
switch ($orgin) {
case 0 : //NORTH
$orgin = rand(1, $this->mapwidth);
for($i = 1; $i < $curvestart; $i++) {
for ($k = 0; $k < $this->riverWidth; $k++) {
$this->map[$i][$orgin+$k] = "||";
}
}
for ($i = 0; $i < $this->riverWidth; $i++) {
$this->map[$curvestart+$i][$orgin+$i] = "\\";
}
$orgin = $orgin + 2;
for($i = 0; $i < $this->riverWidth; $i++) {
$this->map[$curvestart+$i][$orgin] = "=";
}
break;
>>
>>54494245
post a webm you dip
>>
File: 500x500.jpg (30 KB, 500x500) Image search: [Google]
500x500.jpg
30 KB, 500x500
>>54494159
>if err is still a shiton better than try catch exceptions
>>
>>54494574
off yourself exception babby
>>
>>54494574
who cares about adding useful context to an error at every layer, right?
the stack trace and an error message from the lowest level has to be enough, right?
kill yourself if you think exceptions are optimal for anything but noping out when an error has been identified as programmer error
>>
I'm working on a "drag-and-drop programming" project that allows you to drag items from a palette and drop them into any text editor. Once the mouse is released, a customizer is displayed to make modifications. Code is generated after you close the customizer. This is similar to the NetBeans Palette API or learning tools like scratch. The goal is to have this functional with any editor.

I'm trying to figure out the best way to rip the code from the editors after dropping so I can parse for variables/objects/methods. For x11, i'm using the x11lib and libxdo libraries for activating the editor and sending a quick ctrl+a ctrl+ c, then accessing the clipboard in my code to get the text. Certain palette items display functions/variables in the comboboxes, i.e. decisions and loops. This works, but I'm hoping that there's a better way to rip the text. I know that when I add windows support, it's straightforward to get the handle for the active control and inserting/getting text using the win32 api. Any ideas?
>>
>>54494596
/g/ I need some urgent help. So I am trying to write a problem which takes as argument numbers, makes a thread where it verifies if the numbers are palindrome, if one of them is a global variable is summed with 1, and at the end I must print that variable which shows me how many palindrome numbers I've given as arguments.

The problem gives me "Segmentation fault" and I don't know why.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

int nr=0;

void *palin(void *numar)
{
int temp=*((int*) numar);
int i,nrc,copie=temp;
while (temp!=0)
{
nrc=nrc*10+temp%10;
temp=temp/10;
}
printf("%d %d",copie,nrc);
if (copie == nrc)
nr=nr+1;
return NULL;
}

int main(int argc, char* argv[])
{
pthread_t th[15];
int *numar;
int i,trd;

for (i=1;i<argc;i++)
{
trd=pthread_create(&th[i],NULL,palin,argv[i]);
if (trd!=0)
{
printf("Eroare creeare thread");
exit(1);
}
for (i=1;i<argc;i++)
pthread_join(th[i],NULL);
}
printf ("Numarul de palindroame este:%d\n",nr);
}

>>
>>54494574
this

go is fucking stupid
>>
>>54494685
>stop liking what I don't like
>>
What the fuck OOP

I have class Vehicle, and subclasses Boat, Car etc.

Now let's say there's a Location class, and at each location is occupied by a Vehicle (think battleships).

How would I get the type of Vehicle at a given location?

Location loc = new Location();
Car car = new Car();
car.setType = Type.CAR; // ENUM
loc.setVehicle(car);

loc.getVehicle().getType() // ERROR - can't call get type because it's from a subclass



So how am I supposed to know what the subclass is?
>>
>>54494596
>who cares about adding useful context to an error at every layer, right?

You can do that, though.
>>
>>54494670
>undefined behavior
>>
>>54494670
>do the needful
anon...
>>
>>54494763
you are supposed to not be retarded
>>
>>54494763
move the method to the superclass, duh
>>
>>54494797

I started programming 30 minutes ago.

>>54494815

What should it return in the abstract superclass since technically it doesn't have a type?
>>
>>54494763
       
Location loc = new Location();
Car car = new Car();
loc.setVehicle(car);
System.out.println(loc.getVehicle().getClass());
>>
i want to learn common lisp, but the tool the book im following recommends, lisp in a box, is apparently a dead project. is there anything else like it still being maintained?
>>
>>54494836
>abstract superclass
abstract methods don't need to return anything

abstract Type getType();
>>
>>54494773
>>54494785
W-what's wrong? I know maybe it's a retarded question, but I'm trying to learn threads and they give me a headache.
>>
>>54494670
Several things
In palin:
You aren't initializing nrc to 0
i is unused

nr is global, there is a race condition

in main:
You are passing argv[i] to palin, which is a string, not a number.
You re missing a bracket after the first for loop, so the second loop is nested (which is why it's segfaulting)

Are you seriously trying to use threads when you only have a tenuous grasp on the language itself?
>>
>>54494763
visitor + double dispatch
>>
>>54494771
Sure, but why would you use exceptions if you're gonna rethrow at every layer?
All the benefits of exceptions (monadic control flow, performance trade off for full stack trace, try-catch being more verbose than just an early return) don't make any sense when you're rethrowing at every layer for errors which have not yet been identified as a programming error to add viable context for both users and programmers.
If you're adding context at every level, all you need is a single stack trace from the lowest level and a chain of error values which contain context to the point where you're able to identify whether something is a programming error.
If it's a programming error, throw an exception (where exceptions are actually useful!), if it's a user error, make use of the error value.
Go's exception mechanism (panic-recover-defer) and error values (if you want to be explicit about errors use https://github.com/pkg/errors) provides exactly that idiom.
>>
>>54494911
>why would you use exceptions if you're gonna rethrow at every layer?

Because sometimes you need to handle the error at a higher level in the software?

>If it's a programming error, throw an exception (where exceptions are actually useful!), if it's a user error, make use of the error value.

Sure, but this isn't necessarily an indictment of exceptions. Your initial response made it seem like they were useless.
>>
>>54494892
>>54494873
Sing it with me now.
gcc -Wall -Wextra -pendatic -std=c11 -O2 -g2


Also install valgrind and gdb if you haven't and learn to use them.
>>
>>54494945
Why was JavaScript disgusting again?
>>
>>54494892
Corrected nrc and deleted i while waiting for response.

But thank's for the other tips. I failed to see that the bracket was wrongly closed, and also changed the argv type.
>>
>>54494982
Because it's a mess of a language.
https://whydoesitsuck.com/why-does-javascript-suck/

>>54494991
You can't just change the argv type. argv is and always will be a char**. You are going to have to call atoi() on the argument in palin.
>>
>>54495017
>JavaScript is a mess of a language.
Well C isn't that much better, is it?
>>
>>54494935
>Because sometimes you need to handle the error at a higher level in the software
This makes absolutely no sense.
If you're rethrowing at every layer to add context then you aren't making any use of the benefits exceptions offer and only suffer from the performance hit.
Why handle unidentified errors any different from normal values?
Do you also say "oh, one of my callers may need this return value three layers above me, let's wrap it in an exception so he doesn't have to write that single line of code to return from the function!"
You don't.
The only case where exceptions are *always* needed at a way higher level OR should crash the application is when an error has been identified as a programming error.
This idiom is the reason why people randomly mix zero values, nulls and exceptions for errors, because they're never completly sure when to use exceptions.
Monadic control flow is great, but if you're writing a function then you shouldn't make assumptions about how the caller may use the error.
This entire thing gets even worse when you add concurrency to the issue.
Got error values? It's easy, just send values concurrently!
Got exceptions? Either you're fucked or some smart people like Joe Armstrong already came up with a solution to fix that issue for you. Then again, only EVM languages use that.
>>
Poll: what ratio of time do you spend

A) Setting up environment, configuration, infrastructure, deployment etc.

B) Actually coding (structure and algorithms)

me

A) 80%
B) 20%
>>
>>54495082
It's pretty well defined. Just because it doesn't have everything wrapped up nicely doesn't mean it's poorly designed. It's purpose is to generate assembly code as efficiently as possible and contain enough features so that kernels and operating systems could be written in it. Ritchie hit the nail on the head. Yeah, it isn't the safest language, but we know more now 44 years later, and have a lot more computational resources to work with. Can't fault him for that.
>>
>>54495137
Touchè
>>
>>54495124
>80/20
Pretty much, and it infuriates me.
Thread replies: 255
Thread images: 25

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.