/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1492548774511.gif (500x281, 385K)

Other urls found in this thread:

youtu.be/tsG95Y-C14k?t=384
cplusplus.com/reference/ciso646/
qt.io/
twitter.com/SFWRedditGifs

JavaScript rocks!

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

reminder that programming is a subset of Anime

Attached: 1521425412660.png (319x266, 113K)

Behold, the power of C++!
template
void frob(Container);

template
struct Vector
{};

void vector_demo()
{
frob(Vector{});
}

// does not compile
/*
template
struct Map
{};

void map_demo()
{
frob(Map{});
}
*/

// workaround
struct MapImpl
{
template
struct Template_1
{
template
struct Template_2
{};
template
using Template = Template_2;
};
template
using Template = Template_1;
};

template
struct PApplyImpl;

template
struct PApplyImpl
{
using Type = typename PApplyImpl::Type;
};

template
struct PApplyImpl
{
using Type = Fn;
};

template
using PApply = typename PApplyImpl::Type;

template
using Map = PApply;

void map_demo()
{
frob(Map{});
}

JavaScript rocks!

Attached: javascript rocks.png (1000x494, 134K)

chad & stacy JS crossover episode when?

Give me all your programming animu pics, please.

Attached: c.jpg (500x700, 133K)

I'll give this one, I've been saving it for a special occasion.

Attached: DPT.png (934x1000, 389K)

I still have some OC I can't remember posting in the thread

Attached: 1547720201763.png (1000x1500, 1.23M)

>In C++, the keywords 'and' and 'or' can be used instead of the operators '&&' and '||' respectively.

Attached: 1536600752038.png (780x1000, 557K)

this
var ಠ_ಠ = function(){
console.log("Hello there");
}
is valid JS

struct Foo
{
Foo() = delete;
};

Foo bar{};
OH NONONO

Ok that's it, no C++69xz can save this memelang

Attached: 1532696494458.png (550x783, 382K)

>var
Retard

Why wouldn't it be? I mean you're using Indian characters but it's all valid text symbols.

Why aren't you using LLVM?

NO ERA PENAL

Of all the things that could have deterred you from using C++, it was this.

Fine I'll try to get LLVM running.

>using !
i use them all the time, especially 'not'

fun fact: this is an rvalue reference
auto x and = f();

wtf i love c++ now

How do I install llvm on Mac? Does it already come with Clang?

brew install --with-toolchain llvm

youtu.be/tsG95Y-C14k?t=384

What do you prefer lifetimes or a garbage collector or ARC? Not having a garbage collector implies more burden to the programmer such as dealing with lifetimes.

C also have this from C99.
Just use the iso646.h header file.

nice

both

if (MIND == BLOWN)
std::cout

are lambdas in scheme just a way to make an iteration without declaring a function?
is there any other usage?

Thanks frens

Attached: cat2.jpg (320x304, 11K)

C++ was a mistake

It's nothing but trash

> ಠ_ಠ
Wow, guess the time machine worked

It's like a function, except you don't name it.
(define (foo f)
(f 1))
(define (add2 x) (+ x 2))
(foo add2)
(foo (lambda (x) (+ x 2)))


dumb frogposter

Attached: 1520069867162.jpg (2480x3496, 1.6M)

Attached: impressive.jpg (1920x1080, 1.04M)

dumb weebtard

He might be a frogposter but at least he is not a pedo

Nevermind, I found out how to make Clang compile my LLVM files. I guess Clang will be my backend. Interesting times ahead.

yes yes we get it, you prefer reddit. Nothing prevents you from going back

Attached: 1525935064414.png (2537x2462, 2.59M)

How do people not get overburdened by the parentheses? If I get more than two in a row I always make a mistake

>if you don't have creepy and delusional sexual fantasies about schoolgirls you belong on reddit
I see

you get it used to it, it's just a matter of knowing how deep you are.
imperative bits might fuck things up tho

They rely on indentation.

You use an indenter.

you read that right

Attached: 1546966331889.jpg (1000x1220, 175K)

Attached: IMG_6379.jpg (3000x2000, 449K)

>her editor doesn't match parentheses
d-do you code using cat?

Notepad++

>her
thank you for this meme. pls continue

most important is that a lambda is an expression and thus can be nested into larger expressions.

cplusplus.com/reference/ciso646/

Quick question: NTP calculates the round-trip delay using the formula ((t1 - t0) + (t2 - t3)) / 2, according to wikipedia. t0 is sender's time of sending, t1 receiver's time of reception, t2 receiver's time of sending, t3 sender's time of receiving.

Shouldn't that be ((t1 - t0) + (t3 - t2))/2?

fuck you

awesome

also closures

>tfw I crossdress but hate being called a she, because I hate women

How do I get started making things like Desktop applications and working with graphics or audio? I've been programming for awhile but I've never actually done anything that wasn't from the terminal.

Attached: wizard.png (933x1352, 2.96M)

cosmic_brain.jpeg

Just import a library, and it will have objects that create windows, buttons, GUI etc

Unless you are using a non-OOP lang, then it's a pain in the fucking ass

It depends. A lot of programs just use some library which wraps over all of the various native windowing systems (e.g. SDL, GLFW) and just give you some context to draw into.
You could also just use the native windowing system directly, and have a better idea of what the hell is actually going on.

Next time I beat up a crossdresser I ask him, hey do you post on Jow Forums /dpt/?
And if he says yes I kill him.
bazinga

>It's like a function, except you don't name it.
That is where my question comes from though, i will ask in another form:
since i can define a function to to make a recursion already, what usage(s) does that abstraction (lambda) satisfy?
The first thing that comes to me is that lambda could be used as an alternative form of "while {}".

Are there compiled languages that are their own preprocessor languages and any computation that can / must / is marked to be made at compile time just gets made by the compiler in exactly the same fashion as it would be made by the compiled program if it were set up to be part of that instead?

>Next time I beat up a crossdresser I ask him, hey do you post on Jow Forums /dpt/?
Totally pointless, because if they look cute then they post here

Lisp is the most powerful programming language.

learn Qt qt.io/

Common Lisp

I'm a stats major who's pretty proficient in R but currently learning SAS. If I wanted to broaden my perspective careers, would C be the best bet?

He's right. Fuck off or stop complaining.
The frogpost was deleted, and the anime wasn't. That should tell you something.

Use paredit.

Is the compiler able to auto-detect what expressions can safely be evaluated at compile time and elevate those expressions to compile-time directives accordingly?

no
that shit is gay

Java (unfortunately) would be a better bet. C is an important and still-valued skill in the workforce too, though.

Am I on the right track for this? wrote out the algorithm in the comments after blank string, not sure if what I have so far code wise is good

Attached: Capture.png (667x320, 17K)

yuck. I had to take a java course earlier and it made me hate programming. Why java?

Haskell can do this, that's why the compiler takes so long. As for the question of *how* Haskell can do this, the answer is all that academic shit Hasklets always talk about.

Because employers love it, that's why. It's great for making your employees feel like brainless code monkeys and keeping them in line.

>excessive comments
Fuck off

Doubtful. You could probably whip that up as a macro using eval-when.

You can get a Java job if you can fizzbuzz, but if you want a C job you need to write an OS in notepad.
However you will be better respected and better paid

What is this meme?

>for i in guess
>if i in guesses

Attached: 1542487035589.png (476x477, 492K)

Is using itertools in Python preferable to using custom implementations? Some of these are really simple but I hear from people to always use itertools. For example:
list(itertools.repeat(value, occurs))
seems the same as:
[value] * occurs
The latter seems much more readable and precise.

They grade us based on comments
so i dont need a for loop?

wow you're a fuckup

Is there a sticky of some sort that you guys point to newfags?

no
this is pretty much just a shitpost general

You will be writing backend where mistakes will be magnified, so they need someone with experience
Meanwhile Java is a diaper language

No, there are already too many programmers. I want to keep my company golden Mercedes for being a SAP dev, and not have my boss find out a 14 year old could do a better job, thank you very much

The latter will give you an array of length occurs that holds that many references to the same single instance of value, meaning you change one you change all.
If that is what you want then fine, but I would imagine that the itertools alternative produces copies as opposed to references, but I don't know that for sure.
Usually when I want to make a long list of one value I do
[ value for x in range(count)] to prevent duplicate references. I have had some seriously nefarious bugs because of that kind of oversight.

>SAP dev

My condolences.

cmp ax, ex
je

jump to what, faggot

>ex
what architecture is this

HOLY FUCK, God bless the beautiful man who invented LLVM.

Probably. That'd make more sense, time of reception - time of sending.

You mean two-pass compilation? Pretty rare, but there's no reason why you can't write intermediate code that outputs your final code.

You should have an array for all guessed letters. Rather than adding a guessed letter to an array, if that language permits strings to be treated as character arrays, you should place the correctly guessed letter at the index or indices where it was found. You should have a variable to track the total number of guesses as well as one to track the wrong guesses.

>tfw I hate women and like crossdressers but only like ones that use female pronouns because I
I don't see myself as gay