/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1555936849419.jpg (850x1096, 194K)

Other urls found in this thread:

en.wikipedia.org/wiki/Substructural_type_system
techempower.com/benchmarks/#section=data-r18
youtube.com/user/derekbanas
youtube.com/watch?v=Rub-JsjMhWY
fullstackopen.com/en/
lispcast.com/clojure-and-types/
en.wikipedia.org/wiki/Impostor_syndrome
twitter.com/SFWRedditImages

I'm working on POUNDING your fragile, tender, trembling boy pussi like I'm beating chicken into schnitzel

>you fucking nazi autist
Vorher war ich noch so nett und habe dich zurückbeleidigt. Inzwischen nehme ich den Punkt aber gerne an - ich liege in Führung.

If anything it's Yiddish, which ironically was quite influenced by German. But if anything it's a malapropism of the original "Dummkopf". The double "m" is important, by the way, because vowels have two different pronunciations in German, long and short. "Dumkopf" would suggest the long pronunciation (like "r[oo]m"), but it needs to be the short one for which I cannot find an equivalent from the top of my head - the closest I can think of is "d[u]nce".

>Modern C++ memory usage patterns don't result in much different assembly from older C++.
That's not what I said, however. What I said was that the older C++ standards had features that I can defend. I'm not a big fan of C memory allocations either, but with C++ things are getting out of hand.

(You)
>have you ever heard of types?
I'm afraid I can't follow. Yes, I've heard of types. But what does that have to do with anything?

shut up nazi
it's the Chosen People's century

I'm not sure what your point wrt memory allocation is, then. I don't see how RAII focus is any worse than malloc/free or new/delete.

gay

thanks for posting a programming related picture, OP

stop embarrassing yourself, you claimed memory management wasn't possible at compile time, types let you do just that, i.e. memory management at compile time.
Not that your damaged c_brain could ever understand I guess...

Attached: 1557219885539.jpg (800x1131, 537K)

>tfw semantics
wtf is compile time memory managment. just dont compile now you use no memory. wtf

Attached: 1499155082880.png (533x525, 504K)

en.wikipedia.org/wiki/Substructural_type_system

unique_ptr's gotcha. Continue the academic mastubation.

Attached: 1491284636673.jpg (640x360, 39K)

unique_ptr has bad semantics. particularly in the fact that is is required to have a null state

My balls have bad semantics, your mom doesn't seem to mind.

You could write a smart pointer that can only be constructed with a reference if you want.

There must be a null state which is inhabited when an object is moved-from. This isn't the case in real substructural type systems.

Oh, true, I guess you have a point.

I never worked with APIs before. How can I learn to do this? Any tips or tutorial you recommend idk good practices?
For GUI i can just use something simple drag and drop like C# winforms or Java jframe since its not meant to be pretty should just work.
Would working with the API be easier with one or the other of these options or is it pretty much the same for both?

Attached: assign.png (796x198, 20K)

raymoo

Why and how does it happen that someone gets stuck?
I was doing fine coding each part of the problem into a solution, knew what I wanted it to do.

One, two days later, I just don't know what I should do..
I am at my wits end on solving that problem, hindering me to solve problems..

techempower.com/benchmarks/#section=data-r18
The new Techempower benchmark is out, Rust is the best in 5 out of 6 categories.

Attached: Screenshot_2019-07-11 TechEmpower Framework Benchmarks.png (1148x344, 49K)

oh the fuck can you be this dumb, did you even read what it said about unique_ptr?

I'd really like to know why this dude who makes programming tutorials

youtube.com/user/derekbanas

has a million subscribers.

Literally all he does is explain the basic syntax. You could read a "getting started" page in 5 minutes, or watch one of his hour long videos in which he reads it out to you.

I believe the reason why he has a tutorial on every single language and framework on the planet is that he literally just finds doc pages and reads them out.

Look at this shit "Learn C++ in one video"

youtube.com/watch?v=Rub-JsjMhWY

Why do people watch videos of things that could much more easily be read?

>Techempower
literally who

people are dumb

>tutorial introduces basic programming concepts like if statements and loops
>then moves onto polymorphism, pointers, recursion
>... all in the space of an hour

something something loo something something poo

Because they are stupid and/or just pretending they want to learn stuff.

Learning from Derek Banas is shit, like thenewboston.

Contribute to open source projects.

I want to make a (toy) multiplatform music player. I've spent hours reading documentation but I'm not sure if I should be using MPD or BASS or something else, as my audio library of choice. Any suggestions?

libstdc++ is all you need

what is a bloated database giving me that a lean simple ass array can't?

indexes

relational algebra?

why?
don't they want people who already have profound experiences beyond some projects and classes?

54
but I can get that with a simple structure like a goddamn array?

67
is it so hard to write if else yourself?

Hard, no. Inelegant, verbose, hard to maintain and time-consuming, yes.

winforms is easier

Lisp is the most powerful programming language.

I can't program anymore
I become too autistic and thats all I do
as a result self-sustaining becomes incredibly frustrating and makes me suicidal
i rather be a "jack of all trades" stable human being

Attached: 1562825808729.png (1296x1657, 705K)

Halp. Contrived example:
(defn foo
[a b c]
(def bar c)
(+ a b))


If I do (foo 1 2 "hi") it works fine (gives 3) plus sets bar to "hi".

Now I want to map this function to two arrays [1 2 3] and [4 5 6] while setting the third parameter to "hi".

(foo 1 4 "hi")
(foo 2 5 "hi")
(foo 3 6 "hi")


How do I do the above with map? Something like this... (wrong)
(map foo [1 2 3] [4 5 6] "hi")

(map foo [1 2 3] [4 5 6] (repeat "hi")) perhaps? I don't use clojure

in haskell this is just
traverse (uncurry foo) (zip [1 2 3] [4 5 6]) "hi"

so like ... why don't we just have a processor that automatically reads C sources and generates headers for all the symbols that aren't static

That's correct but for my case I'm actually looking for something more like

(map #(foo % % "hi") [1 2 3] [4 5 6]))

no it's not

Because I want to be able to read the headers without having to run something through the build process.
Headers are usually where a lot of your documentation goes.

I don't know why people complain about them so much. They're pretty easy to deal with.

Attached: 1562620250981.png (939x1378, 1.41M)

you can put documentation in the source file then, just like any other language

I don't see the reason to manually maintain a separate file, particularly where it can be programmatically determined it seems like a waste of effort and a violation of dry

With a skirt so short, does (s)he sit on the chair with her bare butt? This is an important programming question.

ah, my bad - forgot to add commas
traverse (uncurry foo) (zip [1, 2, 3] [4, 5, 6]) "hi"

Headers are absolutely unnecessary except when you want to provide an external interface.

>bare
panties is a thing

Currying is dumb shit. The fact that you are incapable of figuring out how it works for even the most trivial examples is a testament to this.

You could, but it's just not worth the effort.

Most programs ARE interested in that, though. The amount of library code you'll find in C is vast.

But what if she wears thongs? Her bare buttocks would touch the cold surface of the char. Can I at least smell it afterward?

>t. rahaj durgamahal

I don't know what currying is I just posted the question. Could you please help me and tell me how you'd write something like this

>(s)he
Cocoa is a girl. It's greatly insulting that you'd write this, both to her, and to me for thinking I would post the lowest tier of fag shit.

currying is a haskeller thing, it gives you partial application "for free"

that said, what's wrong with what you posted? isn't that what you want?

Oh, I'm sorry, I didn't mean to insult anyone, it's just she wears these programming socks so I wasn't sure if she's a girl or a programmer at work.

Why are you using def like that? I don't understand.

Did you solve your problem?

>All the symbols in a library are part of API
Imagine being this retarded.

Sure thing, bud. You can even lick it.

Oh it doesn't work (wrong number of arguments).

I'm not it's just a contrived example.

No. The simplified problem is how do I get the following to print "Hi John and Mary", "Hi Tom and Susan"?

(map #(str "Hi " % " and " %) ["John" "Tom"] ["Mary" "Susan"])

>>All the symbols in a library are part of API
I didn't say that or even slightly imply that.

Attached: 1379244503469.png (716x586, 657K)

how would I start out with basic low level programming?

how low are we talking?

How do I make a property tree that works in O(1) in c++? Property trees in boost use strings as input, i want to be able to do something like
g_root.category.item2

but still be able to iterate over g_root.category and g_root

Please respond

Attached: ba5592ae4bc7c041be485c08003e7db158d71395.jpg (750x925, 617K)

(map #(str "Hi " %1 " and " %2) ["John" "Tom"] ["Mary" "Susan"])

oh my god. fucking kill me.

Like this?
(run! println
(map #(str "Hi " %1 " and " %2)
["John" "Tom"] ["Mary" "Susan"]))

Why do you want header files for every symbol then? Just have one or two for the API. Keep that cancer out of other 99% of a library.

I meant to get into a high level programming language, since I have already programmed before in the past three years just haven't really stuck with it. I need to get into languages like Javascript/Python.

If you don't like the percent signs then you can write it as
(fn [x y] (str "Hi " x " and " y))

If I enjoy Haskell, will I enjoy Clojure?
I like functional programming, and Clojure seems cool, but I also like static types.

In what scenarios is Clojure a better choice than Haskell if you want to build something?

They're not really the same. Yes they're high level but they're used for different things.
If you want javascript then this is the absolute best source: fullstackopen.com/en/

For Python idk where to start really. The language is pretty simple so if you have programming experience it's no worse than just getting started building something - everything you need to know you probably already know.

They're pretty easy to deal with but not as easy as not dealing with them.

That looks a lot better.

Can I use a pointer in just about any situation I'd use a normal variable in?

You may find this article to be of interest:
lispcast.com/clojure-and-types/

Thank you my friend, this seems exactly what I'm looking ofr.

Maybe hash maps ? They're O(1) access and O (N*ln(N)) if I remember well

Yeah, pointers are just ints with some special details attached.

or you know, just use modules and export the desired symbols

Where the fuck did I say anything about any of that? What the fuck are you on about?

Symbols don't have any type information associated with them, so you need additional information.
You can't say "mangle the names" or "include it in the executable too" because object formats aren't exclusively used for C and languages with C-like types and semantics.

Attached: 1560312447857.png (274x301, 16K)

Are you supposed to feel out of place and useless on your first job after getting your degree? Does it get better?

Yeah, it's normal: en.wikipedia.org/wiki/Impostor_syndrome .

You can put any kind of data you like in special binary sections. Debuggers do it all the time.

I don't see how this contradicts with modules

data integrity
transactions

Winforms are so comfy bros...

Can someone please explain in simple terms why c seems to he considered better than c++ and can you also give me some examples of when you would use c over c++ and vice versa?

Attached: 1158591859984489.jpg (1191x670, 84K)

it's less complicated and therefore less easy to fuck shit up in bizarre and difficult to comprehend ways

> why c seems to he considered better than c++
By whom? It's primitive so, yeah, some mentally challenged people like it better, but that's all.

C++ is a giant clusterfuck and an extremely poorly "designed" language. "Designed" isn't even a good word: "shat-out" is more fitting. Anyone with even the slightest hint of good taste will be disgusted by it.

C is actually a pretty solid and focused language.

if C++ was shat out, then C was ejected from an exploding sewer.

It may not be pretty -- sometimes it may be the opposite -- but you gotta admit it's amazing all the stuff they managed to pack into C++.

c++ not only has a massive feature creep, but most of those features are also overly complicated.
c is more conservative, has fewer features and the ones it has are not as stupidly designed. It's still not a great language, but at least it isn't a clusterfuck like c++.

not really, C++ isn't actually all that feature rich, it's just that the features it does have interact in complicated ways

you are a retard

No. Bloating a language with disparate features does not impress me.
In fact, that does the oppose of impressing me.

only underaged suckmeme fanatics and old senile senior devs claim these