[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: 348
Thread images: 19

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>59104657

What are you working on, /g/?
>>
Not anything object oriented, it's garbage.

-/g/
>>
File: 1474325315193.jpg (44KB, 636x616px) Image search: [Google]
1474325315193.jpg
44KB, 636x616px
Employed Haskell programmer reporting in
>>
I hate C with a fiery passion. Besides Rust and Go what language should I learn?
>>
>>59110626
self-employed with no revenue does not count
>>
>>59110635
Definitely C.
>>
>>59110635
If you hate C then you'll loathe C++
>>
>>59110643
C stands for cancer
>>
>>59110646
C stands for communism
>>
Made rock paper scissors in c#. What are some other interesting and small programming projects I can do?
>>
File: 1484627060161.png (439KB, 720x720px) Image search: [Google]
1484627060161.png
439KB, 720x720px
Unemployed Haskell programmer reporting in
>>
>>59110655
Are you me?
>>
>>59110653
He literally just said that
>>
>>59110635
C# is comfy
>>
>>59110662
How is taking the microcock "comfy"?
>>
>>59110662
sure, if by "comfy" you mean "trash"
>>
File: Selection_150.png (63KB, 574x970px) Image search: [Google]
Selection_150.png
63KB, 574x970px
>>59110662
C# is comfy like a horse-drawn carriage.
>>
File: inurmouth.jpg (31KB, 260x325px) Image search: [Google]
inurmouth.jpg
31KB, 260x325px
i'm trying to get into algorithms and data structures so i'm reading Grokking Algorithms

i don't want to be that guy who got invited to a google interview and couldn't traverse a binary tree
>>
>>59110635

vb.net
>>
>>59110655
Why do you define yourself as a programmer if you aren't even employed?
>>
>>59110680
Take your shitty """languages""" to plebbit
>>
>>59110742
Because I program. which means I am a programmer aka one who programs.
>>
>>59110759
I'm the one who programs
>>
>>59110742
"Programming" is not a profession.
To be called a programmer, all you need to do is program.
>>
>>59110635
Rust or Bust
>>
>>59110763
So my mum is a programmer too, because she programs the oven sometimes?
>>
>>59110784
A programmer is someone who programs
>>
>>59110784
A programmer, computer programmer, developer, dev, coder, or software engineer is a person who writes computer software.
>>
>>59110784
Not programming
>>
>>59110800
>dev, coder,
cringed pretty hard.
>>
>>59110635
Modern C++ is quite comfy desu. It lets you enjoy the benefits of C (proximity to the metal and mainstreamness/number of jobs) while avoiding many of the rough edges that make C so annoying to get anything done in.

I would love to see Rust become more mainstream though.
>>
>>59110784
>programs the oven
Who the hell would say "program the oven"?
>>
>>59110852
>proximity to the metal
>quite comfy desu
>>>/r/eddit
>>
>>59110863
>>>/9gag/
>>
>>59110853
Gas chamber operators.
>>
Should I use Visual Studio or a text editor for C++?
>>
>>59110883
You should no be writing C++ at all.
>>
>>59110889
not*
>>
>>59110883
C++ is meant to be done on UNIX lad
>>
whats the easiest way of writing a parser for stuff like JSON? (i.e. many tokens wrapped around each other
>>
>>59110883
>Should I use Visual Studio
That's never a right answer.
>>
>>59110898
C++ is literally the polar opposite of the Unix philosophy.
>>Do one thing and do it well
>Do everything extremely poorly
>>
>>59110910
Write a recursive decent parser. Writing a lexical analyser will make the parser easier/cleaner to write as well.
Just google the terms I brought up if you don't know anything about parsing.
>>
>>59110929
>decent
descent*
>>
>>59110918
>implying
UNIX is best for learning C++.
>>
>>59110942
You're just saying that because C++ follows the same steps as the C compilation process.
C++ is certainly not a "Unix language", and is just fucking terrible.
>>
>>59110958
So, what is your argument? Are you saying he should learn C++ on Visual Studio? Again with the
>implying
my man.
>>
>>59110968
No, my actual argument is that you shouldn't be using C++ at all.
>>
>>59110929
thanks dude
>>
>>59110973
It's one of the most common programming languages used outside of NEET basements. There is literally no reason why one shouldn't know it other than
>stop liking what i dont like!1!!1
>>
>>59110990
it's shit
>>
>>59110990
Just because something is popular, it doesn't mean that it isn't fucking awful.
C++ really is one of the most poorly designed languages in modern use.
>>
>>59111001
>>59111003
>stop liking what i dont like
It doesn't matter if it is shit, if you want a job you should know C++. None of your hipster languages come close to the market share that C++ has. It's just a fact of life desu.
>>
>>59111045
If you're really so fucking concerned about employment, why the fuck aren't you learning Javascript, Java, C#, or other codemonkey languages?
>>
>>59111057
>implying i haven't
It's like you nerds just want to continue jerking yourselves over doing fizzbuzz's in meme languages.
>>
>>59111077
>a language can be a "meme"
Opinion discarded. back to your subreddit
>>
>>59110918
Why
>Do one thing and do it well
when you can
>Do everything extremely poorly

Someone needs to make an O'Reilly cover with that as the tagline for sepples.
>>
Rate my seeples guys.

enum class binop {replace, plus, minus, times, div};

struct CalculatorState
{
double value;
binop currentOperator;

CalculatorState()
{
value = 0;
currentOperator = binop::replace;
}

double operate(double val)
{
switch (currentOperator) {
case binop::plus:
value += val;
break;
case binop::minus:
value -= val;
break;
case binop::times:
value *= val;
break;
case binop::div:
value /= val;
break;
case binop::replace:
value = val;
}
currentOperator = binop::replace;
return value;
}

};


Is it readable?
>>
>>59111435
Fucking kingdom of nouns.
>>
>>59110597
does anyone have a decent explanation of design patterns?
not an explanation of what they are or how they work, rather an explanation of why they aren't fucking retarded?
>>
>>59111450
they ARE fucking retarded
>>
>>59111450
"""Design Patterns""" are fucking retarded, though.
>>
>>59111450
>an explanation of why they aren't fucking retarded?
This question is unanswerable
>>
>>59111435
rate my haskell
data BinOp = Replace | Plus | Minus | Times | Div

op Replace = flip const
op Plus = (+)
op Minus = (-)
op Times = (*)
op Div = (/)

operate i (v:values) (o:operations)
= operate (op o i v) values operations
operate i _ _ = i

-- test = operate 0 [1,2,3] [Replace, Plus, Times]
-- 0 -> replace 1
-- 1 -> plus 2
-- 3 -> times 3
-- 9
>>
>>59111435
yeah ofc it's readable. Personally I'm not a great fan of switch case though. Now it's pretty straightforward but if those operations where just a little longer it might be useful to just equip the struct with private functions for these?
>>
>>59111443
But the calculator needs to store the last operator button that the user pressed, and use that when the = button is pressed.

I don't really want to store arbitrary two-argument lambdas in the state.
>>
>>59111506
like in >>59111503 but fully applied

double operate(binop, double, double);

no reason for that to be tied to your state
then you can use
value = operate(op, value, val);
>>
>>59111506
Use a local variable, you fucking idiot.
>>
>>59111505
>not a great fan of switch case

There are places with elseif chains make sense, and places where switches make sense.

Switches aren't a subset, they suit different scenarios.
>>
>>59111523
well, in that post I call it "op", i don't mean the one i call "operate"
>>
File: 1464594551961.png (375KB, 752x588px) Image search: [Google]
1464594551961.png
375KB, 752x588px
>>59111506
this fucking sepples-tard
>>
>>59111506
you are right and >>59111443 is wrong. Readability is important and by replacing "times" by "tm" or some shit you gain literally nothing. You can always minify/uglify the code before release so it's a smaller file.
>>
>>59111503
You seem to be getting close to implementing a concatenative language. Try using foldl'.

Alternatively, trying using continuations.
>>
Rate my seeples guys.

int vfs_open(const char *path, Inode *&file, int flags)
{
Inode *inode;
DirEnt dent;
FsInstance *fsi;

int mnt = pathToMnt(path);

if (mnt == -1)
{
return EINVAL;
}

LockGuard guard(lock);

fsi = mounts[mnt];

if (fsi == nullptr)
{
return ENOENT;
}

inode = fsi->root;
assert(inode != nullptr);

PathLexer lexer(path);
char buf[4096];

while (lexer.next(buf, 4096))
{
if (inode->type != FT_DIR)
{
releaseInode(inode);
return ENOENT;
}

bool ret = inode->lookup(buf, dent);

if (!ret)
{
if (flags & O_CREATE && lexer.next(nullptr, 0) == false)
{
assert(!"O_CREATE not yet supported");
}

releaseInode(inode);
return ENOENT;
}

inode = getInode(fsi, dent.ino);
assert(inode != nullptr);
}

int err = inode->open(flags);

if (err)
{
releaseInode(inode);
return err;
}

file = inode;
return 0;
}
>>
>>59111545
operate = foldl' (flip (.)) id

operate [const 1, (+2), (*3)] 0
>>
>>59111581
alternatively
(>>) = flip (.)

(do { const 1; (+2); (*3) }) 0
>>
>>59111574
This is a fucking abomination of C code.
You just sprinkled on some C++ crap for no reason.
>>
There's four kinds of developers:
>pajeets that avoid all abstraction
>those that err on the side of less abstraction when unsure
>those that err on the side of more abstraction when unsure
>haskell fags that abstract for every duplication

Which kind are you?
>>
>>59111600
Oh God, you were RebindableSyntax Anon all along?

I salute your insanity, sir.
>>
>>59110694

>trying to get into algorithms

>don't want to be that guy who got invited to a google interview

Don't worry about that buddy
>>
>>59111611
rebindable syntax is the greatest invention of all time
>>
>>59111605
It's sane C++.
>>
>>59111618
By definition, no C++ code is sane.
>>
>>59111622
You may be right, but C++ still offers me some features that manage to keep me on it rather than running back to good old C again.
>>
>>59111629
>You may be right
No. He is right beyond any doubt.
>features that manage to keep me on it rather than running back to good old C again.
Your kind should be shot though.
>>
>>59111606
Abstract when the duplication would reasonably be assumed to crop up as the platform grows. I'm not unsure, I makes a logical judgement based on previous patterns.

Which one is that?
>>
>>59111660
why do you space your posts like that, plebbitor? fuck off.
>>
>>59111668
spacing kind of cleans things up a bit.

problem?
>>
>>59111682
>problem?
yes. we don't need you reddit animals nearby. fuck off already
>>
>>59110597
is there any java library that is actually oop or any language where oop actually works?
The java standard library seems like utter trash desu.
>>
>>59111653
Why does C++ trigger you so much?

Classes, templates, not needing to spam the "struct" keyword, the standard library, and not having to write your own slow and buggy fucking list implementation every time are all good reasons to use C++ over C.
>>
>>59111606
Posts like this serve to convince me that a lot of people don't know what 'abstraction' means.

>pajeets that avoid all abstraction
Protip: Any language that isn't binary is an abstraction.
>>
>>59111653
name one thing in C++ that is a bad practice, something you wouldn't do in C.
>>
>>59111688
OOP does not work by definition. Which means what you're asking for is literally impossible.
>>
>>59111660
It's #3 because you aren't yet completly sure whether you'll need the abstraction as the use case for the abstraction hasn't appeared yet but you expect it to appear.
Of course this also depends on how likely the abstraction is to be necessary - the bigger the chance, the closer you move to #2.
>>
>>59111696
>Protip: Any language that isn't binary is an abstraction.
That post is about creating abstraction, not using abstraction, friend!
>>
>>59111695
>Why does C++ trigger you so much?
Because it's absolute garbage and anyone who uses it should be killed by the state.
>>59111702
Pretty much everything that shitty "language" does.
>>
>>59111696
>calling machine code """""binary"""""
Back to your subreddit
>>
>>59111721
So basically you know absolutely nothing about the language, and you're just spouting memes.
>>
>>59111687


nty
>>
Got a part time job doing C# and JavaScript. Student job so I'm just working on QA Backlogs right now, but they let me edit code for a tool the entire company uses the other day. Really excited!
>>
>>59111729
>memes
I see, I'm not surprised a redditor such as yourself would find sepples to be non-garbage.
>>
>>59111749
>C# and JavaScript
stopped reading right there, mate.
>>
why are there so many angry people in here guys
>>
>>59111754
Do you have any actual arguments, or are you just going to sit here and be retarded?
>>
>>59111707
b-but anon does that mean that having learned C# and java was a waste of time?
I'm not much of a math monkey so I cant into haskell, although never tried it.
>>
>>59111707
>OOP does not work by definition
how does it not "work"? what do you even mean by "work"?

OOP isn't designed to make a language capable of doing something it otherwise couldn't. It just makes handling the code more intuitive.
>>
>>59111761
It's a windows shop working on a webapp for call centers. I'd prefer to be working with linux but at least they let me install vim and bash for windows on my work computer.
>>
>>59111772
Do not listen to fp memers
>>
>>59111785
>bash for windows on my work computer.
stopped reading right there, mate.
>>
>>59111749
Nice blog post. This isn't reddit though so you should fuck off.
>>
>>59111804
so salty lmao

kys
>>
>>59111793
What, you expect me to use cmd or powershell?
>>
>>59111772
>b-but anon does that mean that having learned C# and java was a waste of time?
Depends on what you mean by "waste of time". You're pretty lucky if your goal was to learn something shit. otherwise yeah, you just wasted a bunch of time.
>I'm not much of a math monkey so I cant into haskell, although never tried it.
What does this have to do with math or haskell? Anything procedural is fine.
>>59111792
Where did I say anything about FP? Non-procedural FP is fucking garbage, as I have stated in my previous post.
>>
>>59111769
because when you start writing code there are many ways to do something. Despite there being many ways to do something, there will be agglomerations of neckbeards who have done a thing in a certain way for many years, they inevitably get upset at seeing people do it differently.

Imagine there is a guy who every morning and evening when he leaves and enters his house does so by unscrewing the hinges of his door, passing through, then screwing back the hinges and placing the door again. One day he has a new neighbour, and he sees his neighbour opening the door by turning the handle. Except instead of thinking "oh what a great way to open a door" he throws a fit, calls the way to open the door bad/unprofessional/autism/whatever and throws a fit.

it's exactly like that
>>
>>59111826
>?
Stopped reading right there, mate.
>>
>>59111830
Java or C# are only a waste of time if your goal is NOT to get hired
>>
>>59111830
>you wasted a bunch of time
fuck
>anything procedural is fine
so what meme language should I learn then? Python?
>>
>>59111721
like what?
Checking the index is within bounds when accessing elements in a data structure?
Having functions for when a data structure is created and destroyed?
Having namespaces?
Operator overloading?
What exactly do you, pardon the pun, object to?
>>
>>59111869
>Checking the index is within bounds when accessing elements in a data structure?
C++ doesn't do this.

>What exactly do you, pardon the pun, object to?
Probably the namespaces part. They are pretty shit.
>>
>ITT
Salty C.ucks
>>
>>59111844
Since when does being hired involve learning garbage?
>>59111864
>fuck
It isn't that bad if you can cleanse your mind of the retardation you've been "learning".
>meme language
Don't reply to my posts again. You should consider visiting some website similar to reddit if you think this is a valid thing to say.
>Python?
It's pretty shit as well, but at least it doesn't force you to write non-procedural code as far as I know.
>>
>>59111503
I am really jealous of Haskell here, or of ML family languages in general. Pattern matching is so much more elegant than Switch statements, and autocurrying cuts down on lambdas.
>>
why can't this regexp catch a single backslash?
\\[^nrt\\\"]
>>
>>59111920
Too bad your language doesn't have read macros, or you'd be able to extend your language to accommodate them!
>>
File: 1.png (2KB, 404x404px) Image search: [Google]
1.png
2KB, 404x404px
>>59111962
bump
>>
>>59112085
isn't
\\
a backslash?
so you've got a backslash followed by a maybe backslash
>>
>>59112098
a maybe backslash meaning the [] bit, a backslash or a n or r or t or "
>>
File: hh2.png (278KB, 406x385px) Image search: [Google]
hh2.png
278KB, 406x385px
>>59111834
good analogy, made me lol
>>
>>59111962
\\[^nrt\\\"]+
>>
>>59111523
So something like this:

enum class binop {replace, plus, minus, times, div};

struct CalculatorState
{
double value;
binop currentOperator;

CalculatorState()
{
value = 0;
currentOperator = binop::replace;
}

double operate(double val)
{
value = apply(currentOperator,value,val);
currentOperator = binop::replace;
return value;
}

private:
double apply(binop op, double x, double y)
{
switch (op) {
case binop::plus:
return (x + y);
case binop::minus:
return (x - y);
case binop::times:
return (x*y);
case binop::div:
return (x/y);
case binop::replace:
return y;
default:
return std::numeric_limits<double>::quiet_NaN();
}
}
};
>>
>>59110597
I want to fuck dpt-chan
>>
>>59111887
>C++ doesn't do this.
In a way it does.
I view the STL as part of C++.
Even if you write your own data structures, the lessons instilled from the STL is ingrained in everything people write, I have not seen a library that didn't use assert or throw to catch errors out of bounds requests.

namespaces can easily be abused, I get that, anyone who has used the chronos time thing would want to rip their hair out.
Eg:
std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now();
//function
std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();

double time_span = std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count();

I mean how would anyone be able to use this without looking it up?
>>
>>59112151
apply should not be a member at all
>>
>>59112098
\\ macthes a single backslash yes

i was asking how can i match a single backslash with the regexp i post before

i mean, what would i have to change in this expression to match a single backslash
\\[^nrt\\\"]


you can try at regexr.com
>>
>>59112163
\\[^...]?
>>
>>59112027
Is it really the same as if they were core language constructs?
>>
>>59112160
The struct was defined in a header file. The compiler doesn't like free functions in an .h file, sadly.
>>
>>59112154
>dpt-chan
deport yourself back to plebbit
>>
>>59112197
you can mark it as inline
>>
File: Screenshot - 250217 - 13:55:14.png (36KB, 918x457px) Image search: [Google]
Screenshot - 250217 - 13:55:14.png
36KB, 918x457px
>>59112182
pic related doesn't match
>>59112150
doesn't work mate
>>
>>59112217
put a ? on the end
>>
>>59112197
>The compiler doesn't like free functions
Are you retarded?
>>
>>59112217
My bad, meant
\\[^nrt\\\"]*
>>
>>59112227
He means definitions in a .h
>>
Where can I find someone irl to program with?
>>
>>59112207
explain
>>
>>59112194
What would be the difference?
>>
>>59112259
performance
type checking
>>
>>59112256
Join a computing/electronics club.
>>
>>59112241
So? How does that change my question?
>>
Why is this thread always 6 years behind and people write shit in the most autistic way possible?
>>
>>59112279
Go is shit and so is Rust
>>
>>59112259
this >>59112270 and it being less ugly.
>>
>>59112234
>>59112226
thanks guys!

solved
>>
>>59112274
Because the compiler will refuse to compile if a function is defined in a .h
>>
>>59112258
there is nothing to explain here. someone who doesn't know the name of this girl is a redditor and should return to his home website.
>>
>>59112313
>the compiler will refuse
Here you go again. This isn't fucking possible.
>>
>>59112316
wait she actually has a name? is there porn of her?
>>
File: h and c.png (11KB, 649x100px) Image search: [Google]
h and c.png
11KB, 649x100px
>>59112325
>>
>>59112346
yup, it's on reddit
>>
File: 1486544260376.jpg (113KB, 800x600px) Image search: [Google]
1486544260376.jpg
113KB, 800x600px
What the fuck do people who use Rust do with it?
>>
>>59112354
>the linker will complain
Impossible. Everything else is correct though and I didn't disagree with it or even imply that I disagree.
>>
>>59112358
It's general purpose and Turing complete as far as I know.
>>
>>59112355
not cool man, you can't expect everyone to know about that weeb stuff
>>
>>59112270
You'll have to explain how that will affect performance, as read macros are defined in terms of core language constructs. There might be time taken in expanding said macros, but that's the only instance I can think of. I don't see type checking being much of an issue either. You can see some examples in the area of pattern matching here:
http://quickdocs.org/optima/

>>59112286
Since you can change the syntax, you can make it as pretty as you want. Or as ugly, I guess. Perhaps the code that actually defines said macro could be ugly, and of course it might be useful for the language to include such features to begin with, which is a perfectly valid point.
>>
while(true)

(You)r life in a nutshell
>>
>>59112400
>Since you can change the syntax, you can make it as pretty as you want.
I meant having to including something in the beginning of every single file.
>>
>>59112400
>in terms of core language constructs
Such as? church encoding?
>>
>>59112366
Dude, it just happened for me (linker complaining). Feel free to try it yourself.
>>
C is GOD
>>
>>59112438
It can't happen. no amount of empirical testing can cause me to observe something which is impossible by definition.
>>
File: 1482704825632.png (96KB, 400x400px) Image search: [Google]
1482704825632.png
96KB, 400x400px
>>59112460
No it isn't
>>
Nothing at the moment.
>>
>>59112460
see >>59112472
>>
>>59112421
In lisp for instance, reader macros are defined in terms of lisp. I'm not sure what a language agnostic approach would look like.
>>
>>59112380
So it can't do anything well?
>>
Does anyone here unironically use any JetBrains products?
>>
>>59112506
Lisp is slow as fuck
>>
>>59112529
[citation needed]
>>
>>59112541
The citation was written in lisp and will finish evaluating in 900 years
>>
>>59112547
kek
>>
>>59112547
I appreciated that, thanks.
>>
>>59112518
How the fuck does "general purpose and Turing complete" imply "can't do anything well"?
>>
>>59112460
C is cancer
>>
>>59112579
Programming is cancer
Computers are cancer
Electronics were a mistake
Physics should have never happened
>>
>>59112619
"Yes" to everything
>>
>>59112619
Top quality deflection
>>
File: qnxvy.jpg (54KB, 500x500px) Image search: [Google]
qnxvy.jpg
54KB, 500x500px
>>59111612

>he missed yesterday's blog post on an oop expert who got an interview with google without knowing simple algorithms
>he thinks i'm not going to be more qualified than the oop expert after reading this book
>mfw when im traversing binary trees at google next year
>>
Any way to load images faster/in a more parrarel way on c#? I had problems with slow loading images from a catalog in a server, cause I had to make a <div> on each image, so I used a repeater for now with a handler getting the images through enumeratefiles.
But all this causes the images to load in a linear fashion, making it look like the images are loading really slow when its just handling of them that is slow. I'm new on C# and would really appreciate some help.
>>
>>59112645
>parrarel
Asian?
>>
Can I get a list of the bad things in Java?
>>
>>59112670
All of it.
>>
>>59112650
parallel*, sorry
>>
>>59112670

you will be referred to as a "street shitter"
>>
>>59112400
Is this only in common lisp or do other lisps have that as well? Should I look into CL after I'm done with SICP?
>>
>>59112670
that list is non-terminating.
>>
>>59112670
C based
Needs a runtime environment
C based
>>
>>59112686
Scheme has SRFI-10. I'm not sure how standard it is across the Schemes though. Look into CL anyway.
>>
File: GUH-NU.jpg (68KB, 1024x680px) Image search: [Google]
GUH-NU.jpg
68KB, 1024x680px
any lispers here? stallman claims you will be enlightened after learning lisp to a point where seemingly every other language else will seem like shit. is that true? is it worth putting in the effort to learn lisp?
>>
>>59112670
oracle, library, syntax, primitive types.
JVM is the only good thing about it.
>>
>>59112752
I thought I'd be enlightened, but I turned into a schizophrenic homeless drug addict instead!
>>
>>59112762
>primitive types
What did he mean by this?
>>
>>59112752
It's worth the effort to learn Lisp. Not because it's Lisp, but because your education is woefully incomplete without an accurate understanding of a tool's advantages and disadvantages.
>>
>>59112752
i wouldn't base anything I do on this retard's ramblings. lisp is pretty cool though.
>>
>>59112773
if you're actually asking:
int, long, double etc are not fitting for muh objects.
Wrapper classes are garbage.
>>
>>59112909
Are you saying primitive types should be done away with?
>>
>>59112918
yes and no.
see swift.
>>
>>59112938
>yes and no
What did he mean by this?
>>
>>59112909
>objects
Stopped reading right there.
>>
>>59110783
mah nigga
>>
>>59110597
so usually there are pastebins and shit for generals like this.

Any links I should read before posting?
>>
>>59112997
>being this much of a redditor
your kind isn't welcome here.
>>
>>59113051
well I'm not going anywhere, and you kind of answered my question. thanks, cunt.
>>
>>59112997
ignore >>59113051
just remember this is a blueboard.
also, fuck C
>>
>>59113097
>and you kind of answered my question
in what way? i'm genuinely interested in hearing your shitty attempt at an excuse.
>>
Do you put structs in header or source file in c?
>>
>>59112256
If you're in a large town you might find a hackerspace that isn't complete shit.
>>
>>59113172
Depends if it's local to the C file or not.
>>
>>59113176
>hackerspace
something which is called a "hackerspace" can't be non-shit
>>
>>59112159
>I mean how would anyone be able to use this without looking it up?

Code completion, also:
using Clock = std::chrono::high_resolution_clock;
Clock::time_point
Clock::now()
>>
>>59113235
You've clearly never been to one. The members are usually CE, EE students and sometimes they have pretty cool equipment you can use. Others are full of cringy meme spouting redditors, you can tell before even going.

So if you're not in university, I think it's the best place to find people to program with.
>>
Reading the Haskell wikibook.
>>
>>59113370
ask if you have questions
>>
>>59113370
same. it's pretty anime-like
>>
>>59112159
Not only that but the syntax for namespaces is ugly and retarded.
Like what the fuck was wrong with the dot operator?
>>
>>59113398
Is it hayai?
>>
>>59113196
If 2 source files use the struct, should it be in the headerfile then?
>>
>>59113558
Yes
>>
>>59111720
>pajeets that avoid all abstraction
So you can avoid all abstraction while using it?
>>
Greetings /dpt/

I'm in the making of a larger project in C# (no hate yo)

I'm wondering, how does one structure a large project? Does one plan out beforehand or do you just think on where to put shit when it's needed to made?

Ideas? Are there any general methods one could follow?
>>
>>59112650
I chuckled.
>>
R u s t
u
s
t
>>
>>59113753
B u s t
u
s
t
>>
File: 8l92ECQ.jpg (27KB, 600x800px) Image search: [Google]
8l92ECQ.jpg
27KB, 600x800px
>get to a comfortable level in a language
>reach something difficult
>remain at comfortable level

fug
>>
>>59113624
>that reddit formatting
>c#
Your kind is not welcome here.
>>
>>59110654
Last weekend I made a text-based Minesweeper in C++

I think it's a pretty good project. Arrays, recursion, input validation, etc

>>59110655
>learn skill
>expect employment
Haskell programmers, everybody
>>
>>59113961
>expect employment
where did I say this? I'm not a filthy socialist.
>>
>>59113932
What are you trying to do?
>>
>>59113982
Unemployed by definition means you're looking for work
>>
>>59113989
Learn data structures and objects, mostly
Really basic stuff but I've been spinning my wheels for so long it's a big jump
>>
>>59113999
What would be a word for when I'm not seeking it?
>>
>>59114039
Loser
>>
why doesn't java have delegates?
>>
>>59113999
Ahahaa, what? Far too many die-hard NEETs here for you to actually believe that.

>>59114022
What are you learning from? /dpt/ always pushes CLRS, but it's pretty heavy.
>>
>>59114039
'Unemployed'. He's full of shit.
>>
>>59113999
I have been told that you're full of shit.
>>
>>59114050
>What are you learning from?
Nothing structured. A few years ago I was introduced to C++ in a MechE class, but only for stuff like Arduino and Matlab. We never did much more than was necessary
Since then I've been coding projects on my own, but like I said nothing past my comfort level
>>
>>59113999
The phrase you're looking for is 'actively seeking employment'.

Unemployed just means you're unemployed.
>>
>>59113948
lol fuck you I've been on 4chan since 07 and barely glanced at reddit. This is common structure you little bitch

Also C# is a delight, fuck you
>>
>>59113999
if your retarded post is true then someone can be both employed and unemployed at the same time.
>>
>>59114104
Time to get cracking then. Here you go:
http://ce.bonabu.ac.ir/uploads/30/CMS/user/file/115/EBook/Introduction.to.Algorithms.3rd.Edition.Sep.2010.pdf
>>
>>59114114
>>59114050
>>59114067
>>59114086
>>59114147

https://en.wikipedia.org/wiki/Unemployment
>>
>>59114146
07 as in -0-7 as in 2017?
>C# is a delight
only if "delight" is defined as "complete garbage with no redeeming qualities"
>>
>>59114154
That article literally proves you wrong.
>>
>>59114154
see >>59114147
If you think this is somehow possible it's clear you need your brain checked.
>>
>>59114153
Ok amigo thanks for the link, I'll get going
>>
>>59114203
No worries, bra. Don't get frustrated if you find it to be too heavy, there are plenty of more accessible texts out there, too.
>>
>>59114203
>amigo
>>>/r/ibbit
>>
>>59114214
Translation:
Don't get frustrated if you find it to be too hard to read on account of your mental disability, there are plenty of retard-friendly texts out there, too.
>>
>>59114174
Okay please enlighten me as to why it is garbage? Or are you just regurgitating everything everyone spouts around here?

Do you enjoy flipping bits, non-existent garbage collection, paging issues etc? Cause in the big boy world big boy people have to be productive.

I'm a quite proficient C/C++ programmer (written kernel shit for some shitty radio company).
So please enlighten me, provide arguments for C#'s shittiness except hurr durr google uses Go or some other vapid opinions you might carry.
>>
>>59114246
That's pretty much what I meant, but I tried to avoid being that insulting.
>>
>>59114249
i agree to share my knowledge if and only if a few conditions are met.
The conditions being:
Condition #1 - stop with the reddit bullshit.
Condition #2 - provide proofs for the following statements you've made:
1) I'm a quite proficient C programmer
2) I'm a quite proficient C++ programmer
3) I have written "kernel shit" for some "shitty radio company"
>>
>>59114249
>he doesn't know Rust
opinion disregarded, mate
>>
>>59110646
>>59110653
C stands for Career
>>
>>59114344
>>59110646
>>59110653
>>
Just curious, how many people here actually studied computer science at university or have any qualifications in computer science?
>>
>>59114433
>Just curious,
return to your subreddit.
>>
>>59114433
I have a Masters in Electronic Engineering and am now doing a PhD in Computer Science.

Formal education doesn't mean anything, I'm dumb as a brick.
>>
>>59114485
>doesn't mean anything
only if you're talking about intelligence that is. otherwise it still has some use.
>>
>>59114433
Look who it is again, ID Heaven. I'm fed up with your shit faggot. The other day when you called me a newfag, yeah, haven't forgotten about that yet. Fuck you I've been on here for months and probably get on here more than you anyways. Don't you know that you make yourself look like a newfag when you call others newfag? Just because you learned how to hack your name and change it to "Heaven" does not give you the right to disrespect anyone at any time.
>>
>>59112566
Because you can't say what it does well.
>>
>>59114666
Me not being able to say what it does well means it doesn't do anything well? How can a person have such supernatural powers?
>>
File: output.webm (798KB, 1920x1080px) Image search: [Google]
output.webm
798KB, 1920x1080px
>>59110597
>What are you working on, /g/?
Workin on a remote for my canon EOS700d.
Data transfer between microcontrollers work.
Now just gotta attach buttons, some mosfets and stuff prototype will be done sometime soon
>>
>>59114249
>I'm a quite proficient C/C++ programmer
there's no need to lie on the internet
>>
>>59110635
>toddler hates things
you don't say
>>
#include <stdio.h>

#define ARRAYMAXLIMIT 2000
#define INPUTMAXLIMIT 500
#define CHECK 30 //minimum threshold of line's length to be saved

int inputline(char line[], int lim);
void copy(char to[], char from[], pos);

//check if the line is bigger than 30 chars, if so, copy line to overall[] starting from
//while lines length are not zero, repeat
main ()
{
int len;
int lim;
char line[INPUTMAXLIMIT];
char overall[ARRAYMAXLIMIT];

while ((len = inputline(line, INPUTMAXLIMIT)) > 0) {
if (len > CHECK)
copy(overall, line, len);
printf("%s", overall);
}
return 0;
}

//get line from input, return length
int inputline(char s[], int lim)
{
int i, c;

for (i=0; i<lim-1 && (c=getchar()) != EOF && c!='\n'; ++i)
s[i] = c;
if (c=='\n') {
s[i] = c;
++i;
}
s[i] = '\0';
return i;
}

//copy from from[] to to[]
void copy(char to[], char from[], int pos)
{
int i;

i = 0;
while ((to[i] = from[i+pos]) != '\0') {
++i;
printf("%s", to);
}
}



Should read all lines, and print those, which are longer than 30 chars.
Does not work, where is the mistake?
>>
>>59110635
>I have never programmed but I love memes
>rust, go
Well you kind of listed them already add node to the list and go pratice them at >>>/reddit/
>>
>>59115024
>languages can be "memes"
You should go join him
>>
>>59115068
kek
>>
>>59115008

copy is not necessary

printf("%s", line)
>>
>>59115008
Do you terminate your copy?
>>
>>59110597
Writing a kernel in Scheme.
>>
>>59115240
What? Just paste the entire code, what you say makes completely no sense.
>>59115279
Sure.
>>
>>59115318

in your main you are already grabbing lines and checking against CHECK. you shouldn't have to use a copy function unless you are trying to separate a specific line from the group.

main ()
{
int len;
int lim;
char line[INPUTMAXLIMIT];
char overall[ARRAYMAXLIMIT];

while ((len = inputline(line, INPUTMAXLIMIT)) > 0) {
if (len > CHECK)
printf("%s", line);
}
return 0;
}
>>
>>59113961
I just did mine sweeper in c# and can confirm its a nice project that helps you get the basics down
>>
>>59112151
Finished wiring the GUI, calculator's done: https://github.com/saolof/simple-qt-calculator

I feel like I still need a lot of practice before I can start making something genuinely useful though.
>>
>>59115379
>>59115318

also, you can change getline

int getline(char s[], int lim)
{
int c, i, j;
j = 0;
for ( i = 0; (c = getchar( )) != EOF && c != '\n'; ++i)
if ( i < lim - 2) {
s[j] = c;
++j;
}
>>
>>59115379
I want to print them in bulk after EOF, so copy is a necessity.
Also, just paste full code here or on pastebin, so I could see, if it works.

Gets lines, prints all lines of size 30 after EOF.
>>
>>59115449

sorry, accidental return

int getline(char s[], int lim)
{
int c, i, j;
j = 0;
for ( i = 0; (c = getchar( )) != EOF && c != '\n'; ++i)
if ( i < lim - 2) {
s[j] = c;
++j;
}
if ( c == '\n') {
s[j] = c;
++j;
++i;
}
s[j] = '\0';
return i;
}
>>
rate my fizzbuzz
    DECLARE N INTEGER
DECLARE F INTEGER
DECLARE B INTEGER
N = 0
F = 0
B = 0
FB: IF (F = 3) THEN PRINT("FIZZ");
UNLESS (B = 5)
INWHICHCASE PRINT("FIZZBUZZ");
ELSE UNLESS (B = 5)
INWHICHCASE PRINT("BUZZ");
PRINT(N)
DON'T UNLESS (F = 3) F = -1;
DON'T UNLESS (B = 5) B = -1;
F += 1;
B += 1;
N += 1;
DO UNLESS (N = MAX);
REPEATFROM FB;
>>
>>59112752
This was more true before so many languages offered many of the benefits of LISP. LISP was so good for its time, though.
>>
>>59110597

why would this ever give me a negative

            printf("%f\n",
((input_ray.origin.x-collision.x) * (input_ray.origin.x-collision.x))+
((input_ray.origin.y-collision.y) * (input_ray.origin.z-collision.y))+
((input_ray.origin.z-collision.z) * (input_ray.origin.z-collision.z)));


this is in c++ using the library GLM for the vectors

the x y and z members of the vectors are all floats (single precision I think)
>>
how do i make an arbitrary nested array out of a list of single objects?

each single object has a ref to it's parent(s)

i did it, but it's like 100 lines of if/else and horribly confusing
>>
>>59112909
This is a case where C++ wins … kinda.
>>
>>59110784
>it's a "some retard tries to make a clever remark but is too retarded" episode
>>
>>59115566
arbitrary depth i mean

children have parent1, parent2, 3... ids
>>
>>59115575
whom are you quoting?
>>
>>59114246
>generally being a cunt
>>
>>59115641
refer to >>59115641
>>
>>59110626
Tell me how.
>>
Test
>>
Am I allowed to do this?

fix() {
perform_fix
do_shit
}
do_shit() {
do_the_shit || fix
}
>>
>>59115720
Holy shit, it works!
>>
>>59115495
So? Does it work for you?
>>
>>59115748
Depends on the language. You can do it in Scheme, for example.

(define (fix)
(define (do_shit)
(or (do_the_shit) (fix)))
(perform_fix)
(do_shit))
>>
>>59115403
Starting a minesweeper project in C++ myself. I've written a command-line minesweeper before. I'm still a bit new with GUIs though so making a graphical version should be good practice.

Is there an easy way to auto-generate a square grid of buttons in QT?
>>
>>59115790
>(((Scheme)))
>>
>>59115816
Nvm, I think I figured it out.
>>
Test again
>>
>>59115848
Scheme is objectively superior to every other language. The only languages that even come close to Scheme, in some aspects, are the various variants of LISP, the descendants of ML, Prolog and Forth. Scheme is power. Scheme is mastering the spirits of the computer.
>>
>>59115922
Wrong
>>
>>59115962
Go away, inferior being. Don't ever reply to me or my Scheme brothers ever again.
>>
>>59115922
What's a good Scheme compiler?
>>
>>59115922
My brother
>>
>>59115922
Is scheme better than common lisp? If so, why?
>>
>>59115985
Scheme is awful
>>
>>59115997
http://cubonegro.orgfree.com/sponge/sponge.html
>>
>>59116007
No.
>>
>>59116007
It's a different design. Scheme is very simple compared to CL. Simplicity is good.
>>
>>59115922
No.
>>
>>59116050
In the end scheme's implement the same shit as cl except each implementation is specific and nothing is portable.
>>
>>59116021
Why?
>>59116050
You didn't answer the question.
>>
>>59115997
If you're on Windows, use Dr. Racket. It has a nice interpreter and it can also generate executables. Just replace
#lang racket
with
#lang scheme


>>59116007
Common Lisp has more libraries than Scheme, but its specification is cluttered from years of accumulated trash and due to being a mishmash of other lisps. Also, Scheme is a single namespace LISP, which makes more sense than having multiple namespaces (what this means is that if you have a procedure called x, then you can't have any other identifier called x). The rest of the differences don't matter for someone new to Scheme.

>>59116018
And what do you think is a better language, vermin?
>>
>>59116089
I am entirely unwilling to say that language X is in general better/worse than language Y.
>>
>>59116103
>And what do you think is a better language, vermin?
Any other language.
>>
>>59116104
>I am entirely unwilling to say that language X is in general better/worse than language Y.
Do you think it's unfair to say C is strictly better than brainfuck? If you say yes, then you're a troll. If you say no, then you obviously aren't all that unwilling to admit a language's superiority, except when it comes to admitting that Scheme takes a big fat shit over your favourite language.
>>
>>59115922
No. It's way too minimalistic to get anything useful done in. And the community is hyper-fragmented by all the mutually incompatible implementations and self-appointed standardization committees.
>>
>>59116151
It is unfair to say that C is strictly better than brainfuck. You have not provided a metric by which to compare the two. There are things C is better than brainfuck at, and there are things brainfuck is better than C at. I cannot make a blanket statement. For any language, you should compare its strengths and weaknesses with other langauges and decide how well it fits the specific needs for the task at hand.
>>
>>59110597

new thread up
>>59116218
>>59116218
>>59116218
>>
>>59110597

New thread
>>
>>59116089
Lack of standardization between scheme compilers, need to know multiple constructs to define macros vs. defmacro in CL, fewer libraries, etc.
>>
>>59116216
>useful
>community
try rewriting this post without using buzzwords if you want me to read it.
>>
>>59116234
ignore me i suck cocks
>>
>>59116237
Is it relatively easy to learn common lisp if I know scheme?
>>
>>59116266
Yeah
>>
>>59116243
All right. Try making a basic music player with it, which can apply a high pass or a low pass filter to a .ogg file that is being played.
>>
>>59116266
Should be. Just read the hyperspec and practical common lisp.
>>
>>59116288
Huh? These are completely different posts. I just wanted you to rewrite that previous one.
Why would I be making a music player though?
>>
One more test
>>
>>59116339
You asked me to define "Useful". So I mentioned a typical task that is much easier in a language that has libraries compatible with whatever implementation of the language you are using.

Scheme is super minimalistic with no standard library to speak of. The already small community is fragmented over the different implementations and the new standards cause frequent breaking changes. So no single implementation gets a lot of libraries, and they don't accumulate libraries over time because abandonware quickly gets broken by the next standard.
>>
>>59116454
>community
Almost a good post. If not for this retardation. What is this "community" you speak of? Where do I sign up for it?
>>
>>59115997
Stalin. Idiomatic code usually outperforms GCC.
>>
>>59116526
You're not supposed to reinvent the wheel on every programs. Sometimes you're better off use already written programs called "libraries". These are written by "other people". A large number of "other people" is called a "community".
>>
>>59110635
If you hate C so much, why do you want to learn languages that are so similar to it?
>>
>>59110694
Did anyone screenshot this event?
>>
>>59116813
The guy was complaining on twitter about it. He's the guy who wrote homebrew for osx
>>
>>59116668
>A large number of "other people" is called a "community".
Wrong.
Thread posts: 348
Thread images: 19


[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.