/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: Miller.jpg (550x628, 311K)

Other urls found in this thread:

words.steveklabnik.com/thank-u-next
en.wikipedia.org/wiki/Leitner_system
blog.steveklabnik.com/posts/2011-12-15-marx-anarchism-and-web-standards
yegor256.com/2014/10/26/hacker-vs-programmer-mentality.html
vissi.su/translations/programmer-teormin.php
twitter.com/NSFWRedditVideo

This is a mentally disability friendly thread.

Friendly reminder that KDE has been deprecated.

First for C.

Hello I know this is a stupid question but I need some advice. I am starting college soon(Community for 2 year then finish at a uni). and I am planning on majoring in comp sci. What I want to know is should I learn programming or something while doing my gen ed credits? I heard that you need a portfolio or something to get a good job. since comp sci is so broad I'm wondering if getting a head start will help me in the long run.

Attached: 1544203731005.jpg (960x940, 45K)

I really like that cover

Stay in your containment thread

Wrong thread.

Attached: 15469582181110.jpg (480x480, 12K)

I can't see why Scheme is not practical

>I am planning on majoring in comp sci
>should I learn programming or something
???

CompSci isn't programming, it's math. Major in CIS.

Attached: scrot.png (534x748, 14K)

Raising errors when you do something insane rather than chugging on is clearly the path to impractical code.

Are you implying that Scheme or Common Lisp don't handle errors?

words.steveklabnik.com/thank-u-next

>I don’t have any personal opportunity at Mozilla; I recently discovered I’m the lowest-paid person on my team, and Mozilla doesn’t pay particularly well in the first place.

the absolute state of rustaceans

Attached: steve.jpg (1030x714, 167K)

JavaScript rocks!

Attached: js-rocks.png (1000x494, 286K)

I'm implying that Common Lisp is less likely to raise an error when you do something obviously wrong.

Show an example.

>this triggers the trannies

Beautiful

>I recently discovered I’m the lowest-paid person on my team
Man that sucks. Scared to discover shit like this about myself. My t level gunna hit rock bottom

(cdr nil)

this
const ruleset = [
{factor : 3,word : "Fizz"},
{factor : 5,word : "Buzz"}
];

const fizzbuzz = (amount) => Array(amount).fill(0).map((_, number) => {
var wordchain = "";
ruleset.forEach((rule) => {
if (number % rule.factor === 0) wordchain += rule.word;
});
return (wordchain != "") ? wordchain : number;
});
console.log(fizzbuzz(100));

>(cdr nil)
No one writing practical code would be using slow ass linked lists. Yikes. Also the behavior is well defined in the CL standard. Your fault if you do dumb things.

Is cis good money? I heard comp sci is a safe choice? Anyway what should i do if i want to be a SE in FAANG or somethin?

post curriculum for us to roast

Absolute diarrhea tier garbage.

>Using Lisp without using lists
okay pal
>Also the behavior is well defined in the CL standard. Your fault if you do dumb things.
This applies equally to any language with braindamaged semantics like C++ or JavaScript. Not having braindamaged semantics is preferable to a thousand footguns.

>paying the 11th top contributor to your new language the lowest on the team
guess it's top 10 or bust with mozilla.

shoo shoo pahjeet

I find it arousing. Is it weird?

You mean like C which doesn't hold your hand and assumes the programmer isn't retarded? Yeah of course you leave that out and go straight to C++ and Javascript which have no relation at all to CL. Two languages that were made after Common Lisp. Neck yourself inane faggot.

>the POOjeet uses js
>calls others pajeets

cope

all the money went to fund diversity hires at Mozilla, so of course there's no money to spend

How much type aliasing is too much?
type Deck = NonEmpty Card
type Question = Text
type Answer = Text
type Box = Integer -- tfw no dependent types

data Card = Card
{ cardQuestion :: Question
, cardAnswer :: Answer
, cardBox :: Box
} deriving (Eq, Show)

Damn she's pretty cute.

You can justify any of the retarded behavior in C++ or JavaScript by saying it's "defined in the standard". Just because it's scrawled in a document somewhere doesn't mean it's sane or desirable.

only alias stuff that needs to be alias'd.
Card is a good example because it's comprised of many things.
renaming text to a more specific text is a bad example.

The best part of Ada is knowing that it's never going to fail on me the ability to prove all my functions automatically.

Does anyone have to deal with insecure older engineers at work? Being older they really arent up to date on language features and tend to write very imperative, very manual, unnecessarily verbose code with very brief variable names. Then you come in with lambdas, templates, mixins, metaclasses, etc. and they dont really understand what's going on, so they think (or at least joke amongst themselves) that your code is bad... Of course they never bring this up to your face because they know if they do you'll correct them.

I'll admit I was maybe a bit overzealous, and found out that unfortunately fancy shit doesn't really make my job any easier (just the nature of the work). I've been trying to scale back, but at some point I really dont want to increase my work load and write code that I don't like.

Well it's to be expected of someone who doesn't contribute to the bottom line.

The fuck does Box mean?

>not forcing boomers to adapt to the times
>not telling them no their face, their code is trash and needs updated

Sorry sweaty, but this is the only real solution to fuzz fuck
const fizzbuzzLength = 15;
const fizzbuzzFormats = ["", "Fizz", "Buzz", "FizzBuzz"];
const fizzbuzzLookup = [3, 0, 0, 1, 0, 2, 1, 0, 0, 1, 2, 0, 1, 0, 0];

function fizzbuzz(start, end) {
let counter = start % fizzbuzzLength;
for ( ; start

a magical storage unit for T

It's the box number the card belongs to.
en.wikipedia.org/wiki/Leitner_system

>they write...verbose code...with brief variable names
does not compute

>communist
>worried about payment

>In terms of the actualworkI would like to do, I don’t think a traditional engineering role really suits me.
Wow some actual self-reflection. That's rare. Seems accurate from what I've heard of his opinions.

>verbose is bad
The biggest problem to ever plague programming was the promotion of illiterate languages rather than making a language that could actually be read by a normal bean and states exactly what you wanted it to do on the machine.

>Is cis good money?
Yeah. CompSci sure is safe, but it's also too academic. CIS is just as safe, and it's more business-oriented. You'll get a weaker but still solid theoretical base, but have a stronger practical training in software development and also software engineering aspects (like project management, problem solving, governance, etc.)
>what should i do if i want to be a SE in FAANG
Get a Master's.

Oh, I see.

>communist
where did you get that from the article?

learn basic mathematics
Probability, graph theory, introductory set theory, algorithms, etc.
Understand the source of conceptual machines
e.g. google 'RPN stack machine'
read all of Edsger Djkstra's work
read volume 2 of TAOCP
read a fair amount of the Intel manual
learn x86(_64) and ARM (and AArch64)
use Linux full time (Arch, Gentoo, LFS, whatever - just ignore Debian)
learn some programming language theory
e.g. read compulsory chapters from the dragon compiler book
learn LLVM
write your first linux kernel module
learn hot wo use i2c and SPI interfacing w/ ARM Cortex M0+
the in doing all of that, you'll have a pretty decent understanding of computer science

i dont' know anything about assembly lole, would this corotuine impelmentation wrok if i usedther right inline assembly blocks?
#include

#define JMP(where) do { \
// put inline assembly for a jmp instruction here \
} while (0);
#define STORPC(where) do { \
// put inline assembly for storing the program counter here \
} while (0);

#define coroutine(rettype, name, vars, body) \
struct co_##name##_vars vars; \
rettype co_##name(int isresume, struct co_##name##_vars args) { \
static long long unsigned int pc = 0; \
static struct co_##name##_vars storedargs = {}; \
if (isresume) { \
if (pc) JMP(pc); \
body \
} else storedargs = args; \
return (rettype) {0}; \
}

#define cocall(name, args...) \
co_##name(0, (struct co_##name##_vars) {args...})
#define resume(name) co_##name(1)
#define yield(x) do { \
STORPC(&pc); \
return x; \
} while (0);

coroutine (int ,count,{int from; int to;} ,{
for (; from

>maybe I was overzealous
You'll say this until you're down to very little user. Then you'll start thinking about what it was you actually needed from all those features you used. And then you realize that the language you use doesn't give you that as conveniently as you'd like.
Then you write your own language.

blog.steveklabnik.com/posts/2011-12-15-marx-anarchism-and-web-standards

haha wait no fuck id idit wrong lole, pretend its' like this instead
#include

#define JMP(where) do { \
// put inline assembly for a jmp instruction here \
} while (0);
#define STORPC(where) do { \
// put inline assembly for storing the program counter here \
} while (0);

#define coroutine(rettype, name, vars, body) \
struct co_##name##_vars vars; \
rettype co_##name(int isresume, struct co_##name##_vars args) { \
static long long unsigned int pc = 0; \
static struct co_##name##_vars storedargs = {}; \
if (isresume) { \
if (pc) JMP(pc); \
body \
} else storedargs = args; \
return (rettype) {0}; \
}

#define cocall(name, args...) \
co_##name(0, (struct co_##name##_vars) {args...})
#define resume(name) co_##name(1)
#define yield(x) do { \
STORPC(&pc); \
return x; \
} while (0);

#define A(name) storedargs.name

coroutine (int ,count,{int from; int to;} ,{
for (; A(from)

>you don't care about this but please read it I put something good at the end
>it's a political rant
That's so disgustingly transparent. Who'd actually read that?

>documentation team

shtit lmao its still wrnog
pretend that after setting stroedargs to args iv also set pc to 0 ok ty

sSwr, ppqr, etc. What the fuck does that mean?

Verbose can be unreadable. Giant walls of text that could be condensed to a few short lines of code are bad. A little metaprogramming goes a long way. IMO.

I am acutely aware that C++ isnt great and Python is downright disrespectful. "Python is great!" Guess where I've heard that? There are certain places where it's not only just bad, but counterproductive. That's what we do.

>rustaceans
I didn't realize this was actually what they called themselves. Why explicitly make yourself out to be weak. It'd like gophers. But at least gophers are cute.

Which is unfitting since go itself is much less cute than rust

>reeee why isn't the codebase using lambdas everywhere

Attached: 1469843979355.png (304x366, 231K)

yegor256.com/2014/10/26/hacker-vs-programmer-mentality.html

>t. brainlet

His argument is shit.

>Someone with a hacker mentality would call this Fibonacci Java method an “elegant code” (would you?):
>public int f(int n) { return n>2?f(n-1)+f(n-2):n; }

Hacker mentality doesn't mean being obscure. You can document code and make it readable and have the SAME performance. No those few extra hundred bytes isn't going to kill you.

Lisp is the most powerful programming language.

it's supposed to be "cute", which is ironic, because Rust is fucking horrific looking.

Attached: rustacean-flat-happy.png (1200x800, 32K)

Already complete theoretical minimum, /dpt/?

vissi.su/translations/programmer-teormin.php

>His argument is shit. His description of a hacker mentality does not accurately describe my programmer mentality that sexually identifies as a hacker mentality.
ftfy

99 percent sure JMP can be done by longjmp and STORPC by setjmp. Now I just gotta finish reading your shitcode gimme a minute

>inserting sexuality into everything
This is why no one likes you rust fags

why are you automatically assuming i use a language that on principle i have never touched or taken more than a quick glance at due to the fact that C is the only compiled language you should ever need

>after you've learned all this, you may start calling yourself a beginner

Attached: images.jpg (310x163, 6K)

just the usual - hacking /|/454 mainframe to get all the alien chick picks

Cniles don't mix sexuality and programming, nice try.

>Cnile
Somehow worse.

>Someone with a hacker mentality would call thisFibonacciJava method an “elegant code” (would you?):
>public int f(int n) { return n>2 f(n-1)+f(n-2):n; }
I would say that a Fibonacci function could never be elegant code because it doesn't solve a hard problem (unless we introduce additional requirements or context). And I find that this claim conflicts with where I would expect the article to go.
To me someone that finds this elegant is definitively a person that doesn't think of programming as a systems engineering profession but as a code tweaking profession.
Yegor has targeted a one liner fib implementation here. In real code someone that does that isn't the kind of person who would get software to run well. How short the code is doesn't help your program run well. But we defined a hacker as a platform aware and constraint effective programmer. We obviously shouldn't use the stack for this as a start if we want to run on some memory constrained platform. Especially not back in the day.

I'm thinking this is just a way to get fast and simple oriented programmers to agree and trust him. That's certainly where he was headed and where he is now.

>he doesn't know the "i sexually identify as an attack helicopter" meme
kys c is the only real language

real men use c++ and ride on that UB

Has nothing to do with C you redditfag

that makes no sense, first of all C lets you ride on UB even more than C++, secondly UB is non-portable shitcode anyway, and finally why would real men use C++, it's pretty much just C made easier, you can do anything just as elegantly in C as you can in C++, with just as little code if not less, you just have to think about it a bit harder, something that sepplesfags aren't very good at doing

>What I really love to do is teaching, evangelizing, and growing something.
a professional activists i see, exactly what i expect from rustfags

ub is not always non portable code. and in c++ you have many more types and situations of ub

there is no way you would keep harping on this issue and be so butthurt about it unless...
my god...
>HE UNIRONICALLY IDENTIFIES AS AN ATTACK HELICOPTER

Ok so:
- your initial idea is slightly off since you also have to take the stack pointer and the registers into account, but setjmp/longjmp do it.
- you seem to have anticipated the fact that the stack doesn't magically split by doing the storedargs dance, so that's good.
- setjmp/longmp would probably simplify your stuff a lot since you can jump directly into the functions without doing the isresume dance I assume.
- I think it would probably work as is if you drop in setjmp/longjmp tho. I haven't tried tho.
- (now onto the possible improvements) You instanciate the same coroutine twice. that's a significant drawback imho, but putting storedargs & setjmp on the stack of the parent instead could solve that.
- that macro soup has a learning curve. imho that's not very elegant but that could be argued to be subjective.

C:
>have to think more
>have to write more
>do less

C++:
>have to think less
>have to type less
>do more

You make amazing arguments why noone should seriously consider C over C++

Best Java IDE and is it NetBeans?

IDEA Ultimate

You probably think perl is the best language in the world.

>ub is not always non portable code.
actually by definition it is, it's certainly possible for code containing UB to work well under every currently existing conforming implementation of C or sepples but it still won't be portable to all possible future standards-compliant implementations unless it itself is standards-compliant
>and in c++ you have many more types and situations of ub
yeah, more types, because C++ has so many bloated features you don't need that don't even work well together, and more situations because you are a shit programmer and blindly use C++ the same way you might use a pass-by-pointer shitlang like javeet

what he calls a "hacker" is just some retard pretending to be a programmer that thinks using """obscure""" features and writing shitty one liners like that example is amazing

>>have to think less
some ub in c:
```
int* f()
{
int a;
return &a;
}
```

same ub in c++, variations:
```
int& f()
{
int a;
return a;
}

std::function f()
{
int a;
return [&a](){return a;}
}

```

>>have to write more
brainlet, i said literally the opposite of this, you don't have to write as much in C (or at least C done right)
>sepplesfags can't even read

This is just a bragging by implication that they do know this. See how they list their definition of knowing below the list? Very poor formatting to splice a list and it's motivation like that. They also contradict themselves. I haven't read the list perfectly but I doubt it'd take anyone reasonably clever 3 months to get enough knowledge on a topic to know when to dig it up. Something like C++0x is a contender arguably but I would say it's pretty long for that kind of knowledge.
>duffs device listed under C++
That's how you know they're just bullshitting. It's actually just useless now and impedes compiler optimizations at worst and at best it does the same thing the compiler would have done at the cost of the ability to vectorize the code properly. Manually or not. At best its niche and it should probably fit under compilers or a separate optimization category which they've completely missed out on.

If it were presented as a list of interesting topics it'd be pretty alright.
To require C++0x knowledge to this standard:
>Avalueable knowledge forasoftware developer is not exact NBNS packet format, but methods other developers used, inother words, his ability toreinventor identify those methods indiverse domains.
Along with all those other things is delusion.
Not everyone even needs to know C++. Nevermind the latests standard.

>>>>>the sepplesfag doesn't even know how to codepost

>yeah, more types, because C++ has so many bloated features you don't need that don't even work well together, and more situations because you are a shit programmer and blindly use C++ the same way you might use a pass-by-pointer shitlang like javeet
my c++ mainframe is breaking your c framework

That's no even UB. You've just taken a pointer to the stack. You're not dereferencing it.
That's patently fine.