/dpt/ - Daily Programming Thread

Old thread: Haskell is the language of choice for young POC. It's lazy. It curries a lot. It's not very productive. It consumes lots of resources so that those bad old CIS processes will just have to learn to share.

What are you working on, Jow Forums?

Attached: suckmaidick.png (475x574, 515K)

Other urls found in this thread:

erlang.org/docs
learnyousomeerlang.com/
twitter.com/NSFWRedditVideo

fuck opengl

are you learning it fresh or are you having to adjust to a post-pipeline world?

If you don't like OpenGL then don't try any of the alternatives. Stick to one of those "does it for you" things.

NOOO YOUR FAVOURITE LANGUAGE CAN'T USE LOTS OF MEMORY... THAT'S LIKE MANSPREADING
NOO YOU HAVE TO BE ENERGY EFFICIENT, THINK ABOUT THE ENVIRONMENT

Attached: 1545809685606.jpg (1080x1020, 191K)

The incremental API updates and platform specific extensions are poorly designed.

you have no reason to give a shit about extensions unless you're an AAA gamedev

Now that I have spent two days tidying up and refactoring my code so that it has a more coherent structure instead of being as rush-to-the-deadline hack job, I can see many clear and obvious ways of improving performance, adding new features, and replacing dirty workarounds with much more elegant code.

It feels like combing tangles apart, an extremely satisfying experience.

Hi, I saw 1a bonus problem on a learning problem set that asked for a way to define a function which creates the power set of a given set, and the professor had written a note that he wasn't sure this was possible, but to give it a go. (there were some constraints)

I figured that if you wrote a function which took (A,B) checked if A is a subset of B

and then defined a set which was the set of things which were a subset of B, this function would do the thing, but there would be no way to see if this ever terminated...

anyways does anyone have a way to write this function in haskell? you can either post the code, or just a list of subfunctions and i can figure out how to write them.

C++ fags, I need help with something that has been bugging me since the first day I started learning C++.

Heap stack segment,by that I mean the infamous dynamic memory allocation.

I have a program that demands to load a text file (let it be an excel file) with a list of people, adresses and other numerical datas per column.

Now if my program has to save each person(from that file) in an array of struct.
How exactly do I program said array to have a variable size.
I'm always imagining something like
Struct[x]
{
...
}

Where X would be determined dynamically by the number rows in the excel file I'm loading.

This is just an exemple, I have never understood how to make a C++ program where the array memory allocation would be dynamic, somehow setting a variable instead of a constant number for the array, makes the program crash.
Why is that?

>and replacing dirty workarounds with much more elegant code
This bit especially, since once I see it clearly laid out I can often see that a workaround in one place was only necessary because of a hack in another, so I can remove both at the same time.

t. webdev

>touhou pic
>not video games
??????????????

what was the name of that one dickgirl on male where konata fucks that one guy?

Attached: 1472576651336.png (1280x800, 913K)

Just installed erlang. No idea what to do with it or how to use it.

Haskellfags will defend this totally nonsensically useless code
newtype C c = C { c :: forall f . c f => f Int }

cA :: (forall a . c a => Applicative a) => Int -> C c
cA i = C (pure i)

fC :: (c []) => C c -> [Int]
fC (C x) = x

example :: [Int]
example = fC (cA 3 :: C ((~) []))

Keep these docs in a browser: erlang.org/docs
get a book maybe.
what you should do is write a server.

what, it's just simple impredicative polymorphism, what's the big deal?

No it isn't

>mfw haskelltards can't resist jumping on even the most obvious bait to show off their useless knowledge

Is it a good idea to learn C before C++? Or should I jump directly into the later?

learnyousomeerlang.com/

>learn you so memelang

* (spell '(s a t o r))
(s a t o r)
(a r e p o)
(t e n e t)
(o p e r a)
(r o t a s)

Attached: 1566644123839.jpg (800x800, 72K)

cute ANIME girl
what's the point of the inner 9cel though

Is it bad to use multiple print statements for clarity instead of just one? Does that slow things down? Also I was told pointers are preferable to regular variables in situations where you plan on referencing something repeatedly as opposed to making copies of whatever variable it is (like reusing the same tree model over and over in a game by referencing the address). I feel like I understand the concept but I still can't come up with a specific use-case is my head, and when I think, "would this be better done with a pointer?" I can't come to an answer. Is this just one of those things that you simple wake up one morning and finally understand?

Attached: 1.jpg (1920x1080, 118K)

you use a std::vector
if you want to do it by hand, use malloc/realloc/free or new/delete.

It wards off evil daemons.

it really depends for all of those questions
what language are you using?

Sorry, using C.

If Monad is a subclass of Applicative, does that mean you can write given an instance's >>= and return?

>programming private project on saturday night while being 28kv and living with parents
how is everyone holding

Attached: 1565406098812.jpg (1200x600, 45K)

>Does that slow things down?
typically it does not, due to buffered I/O. strace your process to confirm (and strace it with different inputs and outputs; typically as well, the buffering varies depending on if a terminal is attached to the fd).

What kind of frames should I get for my glasses?

where does opera tenet even come from
yes, now you have an exercise to do

Attached: 1565043450351.jpg (443x550, 58K)

Why are you interested in learning C++?

I heard it's one of teh best languages to make games, it also seem to be an important language in the laboral world. They are currently teaching me C on my first semester on Informatic Engineering at my university.

LASIK

printing once would probably be faster but appending strings is probably slow anyway (unless they're known statically)
with pointers yeah if it's bigger than a few ints, but obviously if you pass a pointer then any modifications you do will apply to the original thing as well
with a tree though are you sure you'd be doing a deep copy in the first place?

>Is it bad to use multiple print statements for clarity instead of just one? Does that slow things down?
In my experience printing to stderr flushes the buffer to screen. Regular printfs should be fine. Alternatively, you could reformat your single printf with line continuations to be more comprehensible.

Attached: 1565361061501.jpg (1007x1034, 160K)

Just concentrate on learning C for the time being then. Try to pick up C++ after but understand 1) the semantics are similar but the idioms are completely different and 2) nobody can agree what good C++ looks like.

thats scary
glasses are more natural and safe :(

A lot of us are in the same boat fren. It's fine.

>while being 28kv
28 kilovolts?

Powerset isnt that complicated, what are the constraints?

yes, 28kilovolts of virginity potential difference

This is one of the stages of accepting opengl into your life.

The most common issue I find while cleaning up my code is that I've been too defensive and some values get checked a validated half a dozen times between changes.

What is the most gratifying-centric programming language and why is it python?

Because python programmers are the most pathetic and have the most room to be gratified

>dynamic typing
>anything but training wheels for your mind
oh but you can go faster vs. falling right over for lack of balance
and you can 'get bike-riding' faster, rather than slowly having to learn how to balance yourself first

The tree scenario was just an example I was given, the image I had in my head was something like a bush in super mario being called repeatedly, but maybe that's not right.
I guess I'll just try to structure my statements in a way that isn't too excessive, looking back, I probably could fit it all in one statement and just split the lines.
Reading all of this has made me realize I understand even less than I thought I did, I'll just focus on getting things to work in a sensible way first, then worry about making it better, thanks anons.

same, except i'm 23

>tfw you got so low that your own mother tells you "whats wrong with you, go find something to fuck, i cant believe you are making me to talk to you this way"

Are you me?

ya mom's a ho. nice.

My mom used to tell me to find gf and a job and to lose some weight.

I figured the first would be easier to achieve after I do the other two first, so I got a job and became Jow Forums. Now my mom tells me my thighs are too thick.

Attached: mice.png (638x447, 607K)

>auto good
>dynamic typing bad
wew

1. join US military
2. when they sit you down in a room and say "sign this if you want the GI Bill", sign it
3. leave US military
4. get paid to spend three days in school for 2 years
5. nice relaxing vacation ending in HR-bypass papers
6. get a job
don't get a gf while you're in the military though.

>Now my mom tells me my thighs are too thick.
she's just mirin' and jelly she can't squat lmao 3pl8

ok shes just being asshole at that point

and srsly they are really selfish ina sense, as in demanding me to get a wife and make her grandkids

accuse her of moving the goalposts

please leave US military, we all know it's you posting
>don't get a gf while you're in the military though
good advice though

LMAO tell her she should do some squats so that she can move the goalposts at all

>The Huffman codes for the two alphabets appear in the block immediately after the header bits and before the actual compressed data, first the literal/length code and then the distance code.
I really wish I could read a sentence like this once and understand what the fuck

Attached: 1567345688931.jpg (1280x720, 99K)

I't the first time I'm working on a big project in git with a group. How do you politely tell someone that their variable naming sucks dicks and then need to do something about it?

If C+++ is such an awful language to work with, why do so many developers and companies still use it (e.g. AAA game developers).

are they one of these dudes
bool m_bMyBool_bool;

Because most of the existing game engines are written in C++

How long after a job offer do you actually get the contract in writing?

But why hasn't anyone bothered to rewrite them in a less painful language (Go, Rust)?

No, I wish. It's more like
int a;
int a1;
char t;
char[] z;

Making a game engine in Go or Rust would be considerably more painful

they're obviously a haskell programmer at heart

I see nothing wrong here.

>But why hasn't anyone bothered to rewrite
Because it's a shit load of work for not enough gain. Prove me wrong.

>for not enough gain
arguably video game development is not a gain at all

video games are the only things worth programming, at least they make people happy instead of giving people autism like linux

Unless it's for globals, that's completely fine. The length of the variable name should scale logarithimcally with the scope.

>literally contributing to the downfall of man and decadence
no thanks

tfw video games will be (are) the only escape from your 12/7 low wage slave job in a concrete hellhole with no blue or green in sight

have you ever wondered what the end goal of civilization is
more work?
no, more leisure time
your ancestors died so you could play video games

This is cuck mindset. I will not rest until the stars are populated by my children.

yeah and taking care of children is for women, don't see what that has to do with the subject although I suspect you're probably pretty far behind when it comes to breeding

>end goal of civilisation
there isn't one retard, coming up with problems is as important as solving them

>end goal of civilization is
anal sex

>coming up with problems is as important as solving them

Attached: aaa.png (256x256, 25K)

>this is what women honestly believe

>arguably
Well sure. You're arguing it so it must be arguable.

maybe you don't get it yet but you will one day
you're probably some dumb ideologues, sceptics, utilitarians etc

Attached: 1566120877206.gif (292x319, 689K)

the meaning of life is immortality

I'm neither arguing nor squabbling. I am merely tending to my humble C program.

Attached: 1568176236664.jpg (577x433, 89K)

>society progresses to the point where technology can provide for our every need and there is no scarcity of resources or need to work
>"fuck, we don't have enough problems"
>nuke all of it to the ground, back to the stone age
>"maybe you don't get it yet but you will one day"

The cuck mindset is going about your fatherly duties, blindly niave that your wife is getting railed and that your are a fucking loser. Don't confuse it with the fetish.

You actually sound more like the canonical definition of a cuck.

exhibit A: a braindead communist

because it's the least awful language that still allows you some sane level of productivity and development speed without seriously negatively effecting performance
the current state of everything is shit
it has been shit for decades
it will always be shit

well, at least until 2023/2026
or whenever the committee decides to actually integrate the metaclass proposal into the standard and c++ finally becomes perfect

technological progress is communism? are you American by chance?

look dude it's obvious from your post, there's no point lying to everyone and embarassing yourself by taking only two words from your post (not even next to each other mind you) and saying you're being misjudged

'no scarcity' is communism.

what is it with these idiots who think slapping one more feature onto the most bloated language of all time will suddenly make it good