/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1555239890844.jpg (1280x720, 781K)

Other urls found in this thread:

en.wikipedia.org/wiki/Shunting-yard_algorithm
github.com/metasprite/mage
github.com/amatus/sdl-examples
reddit.com/r/programming/comments/c13vph/serenityos_a_marriage_between_the_aesthetic_of/
twitter.com/SFWRedditGifs

nth for Nim!

Imagine wasting the first post like this.

Imagine wasting the second post like this.

I posted this earlier in a different thread but what's a good reading order for these books? My previously read Lisp books are: "ANSI Common Lisp" and "Gentle Introduction to Symbolic Computation" - I'm currently reading LoL. I was thinking LoL->PCL->PAIP->SICP.

Attached: thzuvcegijuc.jpg (3264x2448, 3.83M)

The typical order is SICP -> skip the rest.

nice programming books but where are the fumos?

I-I don't have any >.

the typical order is to throw them all into the fireplace

I've only read SICP and Practical Common Lisp, if you already know CL then the latter is a waste of time.

i want to nakadashi senko-chan

I know CL but I don't feel like I know it well.

working on learning haskell. pretty fun so far

What resources are you using to learn it?

The book is a tutorial that guides through a few simple programs, I think your time would be better used trying to actually write something in lisp rather than reading another book.

Alright, thanks for the advice. You're probably spot on I should start actually using the language more than just reading books.

"Haskell Programming from First Principles"
I tried LYAH, but the lack of exercises made it unappealing.

Fuck sepples. C is the better language. Sepples has bloat and classes are just structs with methods.

each has use cases

readung books is a waste of time, just read the first 3 chapters and jump straight into a project

Just watch YouTube tutorials and google stackoverflow ffs. Or don’t. Not everyone should program.

>watching youtube is a massive waste of time
>reading books is a waste of time
>stackoverflow is a waste of time for nontrivial problems
>blindly jumping into projects is a waste of time
What isn't a waste of time?

watching anime and playing video games

>muh use cases
Just stop shilling your shitlang already

Just don’t program. It’s not for everyone.

Haskell

wrong

Write a recursive method to construct a graph like this (undirected)

Attached: 1560607349528.png (560x560, 101K)

Should Java do something like this to be less verbose?
boolean function(T x, T y) {
return x.equals(y);
}
//calling
function(stra, strb);

Basically it infers the type T from the arguments instead of passing a generic type parameter.

it already does do this

blindly jumping into projects isnt a waste of time

doing things blindly isn't a waste of time but programming projects are

umm ya it is. if you just start hacking things together you will have spaghetti code that is hard to work with. i made a chess engine and realized half way through where it was heading and started over with a better idea of how i should make it.

Huh, so it does. Why doesn’t it do that with constructors too?

>umm ya it is
your post, your opinions and your entire life
totally disregarded

>i made a chess engine and realized half way through where it was heading and started over with a better idea of how i should make it.
and you're implying that's a waste of time? you learnt something, so it was a valuable use of time, and learning by failing teaches you 100 times more than anything you will read in a book. that's exactly how experts work, the first system is always a draft, you remake it afterwards when you've learned what was wrong with your initial approach

Any ideas for a useful problem to solve?

The reddit problem.

What are you talking about?

it does you just need to add to the type name

a good OS written with non C-shit.
re-write the linux kernel in a new language.

suffering from coder's block

write your code in python first and then rewrite it in the new language

What language has the longest average programmer penis size?

x64 ASM

English

In the wild, Python programmer penises grow to 5 m (16 ft 5 in) on average

Python 2

Brainfuck

D

In C, when a pointer like..
struct AStruct *current = Structure->first;
Is it important to free them or is that only something I do if i've malloc'd?

K&R recommends to free them.

dont bother freeing pointers, it's a waste of time

a pointer is just an int

see The Operating system will free all malloc memory upon finishing execution. You only need to care about freeing memory for programs that consume more memory than you have of RAM.

if the pointer points to something on the stack, freeing it is undefined behavior
if the pointer points to something that's been memory mapped, freeing it is also probably undefined behavior
only free pointers you get from malloc, calloc, or realloc

Longest: Swift
Shortest: Common Lisp

Kill yourself Itoddler

Attached: 1560193989309.jpg (1003x900, 84K)

you seem a little insecure about something ?

swift is based, boomer

speaking of apple shit, why did they bother to release Swift and XCode on Linux?

To pretend they support portability

recursion is not the most efficient way to produce that graph, and you could do it in constant memory (though the output SVG would be a factor of N)

is it true that crossdressing makes you a better programmer?

before I get attacked by a magical brainlet, it's just a mildly complicated c-style array which can be interpreted as a spiral, and where each element can be indexed in 7 different ways.

how the fuck do webdevs use Atom.
Literally uses a fucking gig and change with only 2 buffers open and every non-essential plugin disabled.

Where do I find the swift documentation for xbox controllers?

My operator precedence thingy seems to be working. Was slightly harder than I had thought.

Anyone know of any good books or video series to learn data structs for C? Trying to learn lists, stacks, and queues but my book has this tiny little fucking section on it that barely covers it.

did you use the shunting yard algorithm

read the wikipedia article

I ended up making a linked list and iterate over it in the order of the precedence. Don't know if that has a name or anything.

rec_iterate(root, '/', division);
rec_iterate(root, '*', multiplication);
rec_iterate(root, '-', subtraction);
rec_iterate(root, '+', addition);

en.wikipedia.org/wiki/Shunting-yard_algorithm
it's more efficient but more complex to implement

isn't their OS based on linux?

Interesting. Perhaps I'll do that later, although efficiency is pretty irrelevant when the input size (and amount of operators) isn't even in the hundreds.

It's a clusterfuck of BSD and Linux, yes.

It's a modified Windows that only runs paint programs

Same, man. I quit my job recently because I felt like I wasn't qualified for it and wanted to re-learn the basics. Problems that were trivial for me to solve 10, or even 2 or 3 years ago, feel like herculean tasks now. I don't know what the hell happened.

you really quit your job over that? holy shit man.

Well, also I didn't really want to deal with pajeets ten and a half hours ahead of me changing the entire codebase overnight. Like, I felt like I was underqualified for the whole "fast-changing, move-fast-break-things" environment you see in a lot of startups. It made me question how people were able to survive in those kinds of environments and what my problem was, so I figured it had to be something to do with how I learned programming initially.

>and what my problem was
you cared enough to realize you were a weak-link. Whereas everybody else tries their best to cover up being shitters until they don't have to anymore.
good on you lad.

this is exactly my fear as a student. I fear once I'm done with this degree I'm going to find I wasted my time because I cant keep my head above water once I'm out in the workplace.

When I was an engineering major funny enough I didn't have this fear, now that I'm CS I'm paranoid about it.

I've had people tell me don't worry, I'm a good people person and have a good business so I could always switch to project management if that's the case, but I don't know.

>how people are able to survive in those environments
By not giving a fuck, user. Quality code belongs only in your personal projects. Startups are made out of duct tape and lies to VCs.

business sense*

That might be it, man. I guess the next question is "Where do I go from here?" I still love programming, I just think I need to re-learn it, or start even lower level than I am right now.

Impostor syndrome is real. It's hard to stay interested in the newest and coolest technology when you're mentally exhausted from a shitty coding job where you're not really learning anything. It feeds a vicious cycle, but if you're aware of it you can break out. That's kind of where I am right now.

That sentiment makes me sick. I've been flown out to the headquarters of major companies as a vendor to sell them shitty software that doesn't exist because we want to trick them into paying us to make it. I don't ever want to do that again. I'd help middle-aged women set up fitness wordpress blogs for the rest of my life before wading back into that shitfest.

>He isn't subscribed to cppcon on youtube and thinks his opinion in anonymous board matters.

Attached: de15df26e9bf61c4f5672a08dc60a50b.jpg (499x481, 28K)

>It's hard to stay interested in the newest and coolest technology
only idiots do this

Frogposter opinions don't matter either

>buh the os has garbuge colelctueiong . ga;dgkjds
brainlet. If you are looking for important memory leaks or bugs you will be fucked. If you arrive on a platform that does not collect the heap you are fucked. If you run out of heap because you leave memory all over the place in runtime you are fucked. Basically you're fucked. Free your memory folks.

Attached: 087cf63b34bf423b523655408908ce9eba0d5e5a0302f3855e59b9a12d431b25.jpg (334x411, 36K)

Well, while I'm re-learning the basics, what do you suggest I do instead? My approach was always to evaluate tools based on what I needed at the time, but that got me a mishmash of half-assed domain knowledge and no real expertise. On the other hand, doubling down means I run the risk of being pigeonholed into a particular stack and not fitting into other companies. I'm just not sure where to go from here. I've needed to be an expert on something totally different in each of the jobs I've worked.

>tfw too many langs
>tfw not enough time on this earth to learn them all
Just give me GITS tech now and let me be eternal.

Making a simple "ifconfig" program for my operating system so I can see what network adapters I have.

Attached: Screenshot at 2019-06-16 07-24-39.png (1920x1080, 805K)

well being interested in the newest and coolest technology may well get you a job, knowing the fundamentals is what makes you a good programmer

Every modern OS frees up all memory resources from a process upon exit. It's a huge safety feature. How do you think modern OSes handle programs that OOM as is, retard. Unless you're on some obscure OS used by a specific industry you're not going to run into an issue.

This isn't the era of DOS anymore.

Is there any good method to make the paint program in SDL2? All I found is these examples:
github.com/metasprite/mage
github.com/amatus/sdl-examples
And I don't really like the result they give.
Is there a way to improve the strokes? How hard it is? Would it be easier with some additional library?

Attached: paint.png (640x512, 8K)

Are you me?

I was a chemE major but i dropped out of my chemE program because the jobs don't pay well unless you're in oil. The locations are out in the middle of no where and 50-60 hours a week with on call duties is considered the norm. On top of that its also a tough field to get into and entry level jobs are sparse.

I switched to compsci because locations are better, pay is normally better, and hours are normally less but im scared shitless that i made the wrong choice. Its hard to get interested in the topics. I feel like I'm drowning because creating code doesn't come naturally for me.

all paint programs draw a straight line between each coordinate rather than placing a dot

Yes, I also had that idea in mind! Perhaps I'll do it just like this then

you're gonna have visitors
reddit.com/r/programming/comments/c13vph/serenityos_a_marriage_between_the_aesthetic_of/