/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: haskell-bordered-turquoise.png (214x230, 16K)

Other urls found in this thread:

pegasoft.ca/resources/boblap/book.html
hg.libsdl.org/SDL/file/
wiki.libsdl.org/SDL_CreateTexture#access
twitter.com/SFWRedditVideos

I'm falling for Ada.

Attached: 1496292281493.jpg (1267x887, 100K)

Lisp is the most powerful programming language.

I'm gonna say the n word!

Nim?

Ada is based. It's the opposite of minimal. If you want minimal then there's Agda.
Never say never

which is better for large systems: procedural, functional or object oriented programming? oop looks like a pile of crap desu. some concepts are nice, but the aggressive encapsulation looks way too painful to use. im still too inexperienced to see proper application areas when i program my own shit. do i even bother learning it even if i primarily program in C++ and C# or do i just go full functional?

based defense contractor

I'd like to train a neural network to detect wojaks so I can filter them out. Is there anybody bored enough to have hoarded a decent sized training dataset?

pegasoft.ca/resources/boblap/book.html

:)

All large systems are a crapshoot regardless. If you can modularise it, that's good. Depending on the problem, one or the other might be more suited for doing it.

Depends on the system
OOP doesn't require you encapsulate things

>Depending on the problem, one or the other might be more suited for doing it.
Oh, and the nice thing is you usually can't tell in advance lmfao

Attached: 1567627969791.png (410x454, 139K)

What is this meme with Rust and trannies? Is it really that bad?

what if i apply microservices as a way of modularising instead of bothering to write a large oop code base in 1-2 applications? ive recently learned how to use WCF at a basic level and am building a small backup system with plans to go full microservice

dod with as many semi-/pure functions as possible.

>Oh, and the nice thing is you usually can't tell in advance
Basically if you are writing really low level code like an operating system or drivers you use procedural code otherwise you use OOP
functional programming is the joke option put there to trap you

>what if i apply microservices
1000x worse

Attached: kaori saeki.png (400x480, 211K)

>what if i apply microservices as a way of modularising
lay off the webdev, it's rotting your brain

Rbros...

Attached: Screenshot_20190908-020428.jpg (1080x2246, 599K)

why? hard to maintain the entire system im guessing?
i didnt get this idea from web devs

>R
>Matlab
This absolute garbage is top 10

Practicing F# by writing a simple regex parser.

F# is literally such a comfy language, I cant believe it's taken me so long to try functional programming

do you prefer knowing 20 languages or mastered a single one

parse this

The only language you "master" is C++, all other languages can be picked up in a few days by a decent programmer

>Rust no where on the list
>Java above C

Attached: 1498616414733.jpg (880x1024, 86K)

Exercises in a book, writing applicative version of set functions, then recursive, then tail-recursive, and so on. Kinda boring but sometimes it makes my brain hurt so I'm probably learning I guess lol. Once I'm done with that, on to recursive data structures.

(defun tree-find-if (fn tree)
(cond ((null tree) nil)
((atom tree) (if (funcall fn tree) tree nil))
(t (or (tree-find-if fn (car tree))
(tree-find-if fn (cdr tree))))))

when are you going to move to a relevant programming language

Is there a reason you need .NET? If not you might as well use the real thing

Like what?

Fuck just realized my function needs to be more general, and not just operate on atoms. What if I want to find the first list of length 4 or some other non-atomic shit.
Damn it.

Reactive Extensions sure promises great things, but holy fuck, every project that depends on it is severely under-documented.

I've been wanting to make a cross platform app using the native platform capabilities via Xamarin (iOS & Android) and UWP for Windows (and maybe even XamarinMac and GTK#) and use ReactiveUI for that, but good fucking god, the documentation is horseshit.
How do you bind your data to a list / table? What is ReactiveTableViewSource? Why does it only get like 5 google search results, with one of them being a Stack Overflow post that claims to use it, while using something entirely different that also doesn't work?
There's like ZERO advice on anything that isn't WPF, which is puzzling for something that claims to be cross platform.

It's a shame. All I wanted to do was share the non-UI code and even share some Interface related code using the MVVM pattern. I thought Xamarin was perfect for that. But apparently, no. Apparently, the way to go nowadays really is to either completely ignore native UI and go Flutter so you can share code (and get custom UI, which is what customers mostly want, anyway), while still having a good developer experience with lots of helpful advice online, or to go native for real and share absolutely nothing, but replicate every line of code in Kotlin, Swift and C#.
I mean, there's also MVVMCross, but I don't want to use an actual framework that abstracts away the native platforms and thus hinders my ability to customize.
What a shitload of fuck.

What does Jow Forums use for mobile apps?

Never probably.

I've done some work in pseudo Fortran 77 and I like Ada, but relevant languages are never any fun.

Thinking about exploring some Prolog soon, once I get to where I can implement it in Lisp, then probably Smalltalk. Maybe take a stab at Forth as well.

it's like snake oil only without the general property of oil making things run more smoothly

Still looking for explanations of the speed of sdl2 functions

I feel like I've been googling for an hour now and it seems no one on the internet felt it was an important question.

I'm making an indexed color editor with a modern take on pallet cycling and layers so lets say 16 layers, morden resoltions and 16 bit index; is allot of drawing calls so I need to do things smart, it seems to me "use surfaces" may be wrong as I will be effectively editing major chunks of it every frame;

maybe I mantain point lists of the major colors so I don't need to vomit 5 ints(xyrgb) into the gpu to draw each point, but its unclear if that's actually doing anything smart.

I think I need indepth explanations of what is doing what on cpu vs gpu; but I can't find it for fucksakes

Functional just werks

why don't you test it you fucking idiot?
even if there was documentation, you should be testing everything yourself anyway if you care about performance

why do people like this exist

just test it
if whatever you are making runs slow, that's when you need to optimize

boomers?

>one guy tells me functional programming is a joke
>other one advocates for it
god damn it /g

Attached: Screenshot_194.png (128x164, 14K)

boomers are all practical programmers who use some boring language that gets the job done
this person is a programming hipster who doesn't care about getting anything done

>I've done some work in pseudo Fortran 77 and I like Ada
>Thinking about exploring some Prolog soon, once I get to where I can implement it in Lisp, then probably Smalltalk.
>Maybe take a stab at Forth as well.

Attached: flat,750x,075,f-pad,750x1000,f8f8f8.jpg (750x1000, 76K)

>Two people have different opinions
How dare they!!! Why isn't there a single bandwagon to follow???

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

yeah it's a cult, the cultists all pretend it's good and normal and is something people use in real life when it isn't

My stack pointer is 0x11 and I want to die.

Because programming is not my job, so I do what I find interesting?
lmao called it, I'm 34

>tfw like both prolog and smalltalk

Attached: 1531584968020.jpg (2527x1440, 216K)

Non autistic functional like in scheme is easy to understand, composes easily, is maintainable and doesn't really inhibit you in any way

So does a decent OO system like CLOS tbqh

I like C!

Is there a modular codebase that is easy to debug?

relax, i know that opinions exist. but there is a difference to preferring something and calling something that you dont like a joke without any argument. "hurrr X thing is joke". im curious as to why, because all paradigms seem to have their own place it seems

yes? why wouldn't there be? the things that make codebases difficult to debug are things like macros

>all paradigms seem to have their own place
Spotted the web dev

Attached: onions.png (644x800, 15K)

functional programming is the virtual reality of the programming world. It has a lot of hype, and a little bit of use, but it's basically a novelty. People will pretend it isn't though and eagerly tell you about how Facebook uses it or whatever (as if big companies aren't exempt from falling for memes)

what makes you think that im a webdev? c++ and c# are my main languages. if it makes you feel any better i didnt enjoy making my web portfolio

Testing it means writing 100 lines of janky correctly of code for what is a yes or no question

And then I have 6 different ways to vomit pixels to the screen using the api

I'd honestly swap to a different framework that had documentation on the topic before writing the vomit pixels to screen 6 different ways to see which one happens to be the right one for reasons I don't understand.

Because to make software modular you a generic interface to the modules. Creating a generic interface normally increases the code size and makes thing indirect/hard to follow, because you have extra layers between code which only purpose is to interact between the modules and has nothing to do with the logic of the software that actually does something.

>what makes you think that im a webdev? ... my web portfolio

Attached: unknown person.jpg (3241x2592, 1.63M)

you need a generic*

hard to get a job without one you know

>Testing it means writing 100 lines of janky correctly of code for what is a yes or no question
you should be able to test anything in a few minutes. Sort that shit out, testing things is an essential part of being a good programmer.

Following code with no interfaces is alot harder to follow. But all code is broken up in some fashion, what do you think a function call is. Modules are no different. You just follow the thread of execution however many layers deep it may go

Functions are clearly different from modules, otherwise all code would be modular. Regular functions directly do what you tell it to do, modules require abstraction that describes all the allowed interface; and sometimes requires readability sacrifices in the interface to make the generic function call work

>Cant get through book chapters because of ADHD
>literally fall asleep after 10 mins of reading
>CAN get through online language tuts that cut everything into smaller pieces with actual examples
>Not being able to process books
I'll never be good as I could be not even that Pomodoro bullshit timer works with textbooks for me.Why couldn't I have high functioning autism instead huh God?

Attached: 463636.png (811x1024, 1.47M)

Functions are abstractions that describe an allowed interface too. If you think they're fundamentally different you don't understand programming well enough yet

Nice blog

>neoreactionary meme art
um yikes just go be a farmer or something

>putting God in your post makes you a neoreactionary

Attached: ECjuQrIXUAAdKI_.jpg (680x524, 57K)

?

if "SDL_RenderDrawPoints" is smart and it sends only 2 ints to the gpu; making a optimal system that I have in my head would mean building a new large array of points, maintaining a "sort" of that array so that the first 1000 pixels are one color then 1000 are the next ext, having janky pointer logic, making tools to edit that array quickly and then make a function that iterates over it quickly.

This has no over lap with other methods, is not "a few minutes" to check and is full c style pointer jank.

I want to read documentation of low level code before I build anything on top of it; your just wrong.

Everyone I know who regularly used Rust was an antifa looking cuck. Boomers who don't like C use Ada.

Why not master 20?

>t. mastered 0

>t. projecting

>t., mr t

The fastest drawing functions are SDL2's render to texture ones, but they are still slow compared to using a GPU raster shader.

Attached: 1564277170915.jpg (907x842, 85K)

>calls people bandwagoners
>only speaks in memes and Jow Forums catchprases because can't have original thoughts
lmao

Nice use of greentext

>taking a wojakposter serious

im not the one trying to be original.
>thinks im serious

Does that actually apply when I'm changing the texture every frame?

I'm aware its the standard answer, and maybe I can just multi thread it and call it a day. But that explanation is that the texture lives on the gpu and your drawing your sprite from cpu once, if that one time cost is rather expensive and I actually pay it over and over again the logic breaks down.

Changing the texture every frame in software means you're uploading it to the GPU every frame as well. There's no way to directly access VRAM because your texture is probably in some indeterminate place in the pixel fragment/texture streaming pipeline. If you want to palette swap efficiently you will have to do it through a GPU shader.

Attached: 1564424072024.png (800x600, 549K)

#include
#include
using namespace std;
int main() {
int a;
int n;
mt19937 mt(1729);
uniform_int_distribution dist(0, 20);
cout n;
for (int i = 1; i

Sorry mates.
#include
#include
using namespace std;
int main() {
int a;
int n;
mt19937 mt(1729);
uniform_int_distribution dist(0, 20);
cout n;
for (int i = 1; i

Nullable

based. How bout this.
I'M GONNA SAY THE N WORD
srand(time(NULL));

I don't think that entirely true, but thank you for confirming at least one idea is probably trash

You wouldn't happen to know if draw pixels is something intelligent gpu side?

why not cout

>How many times would you like to roll for?
>0
>gets all the rolls

Thanks for bringing that to my attention! I'll fix that out in a bug lmao.
Y'know, I could do that indeed.

No real reason, I picked it up after doing some C# at my internship and hearing about this cool functional language extension called F#. Plus, .NET runs on my linux machine, so no problems there.

If you're referring to Haskell, I plan to learn it at some point, but I wanna learn Elixir first. I'm learning languages to learn new paradigms, and functional programming is only one of them.

>inb4 rust
I already know C++, thanks

I am retarded and my code is useless.

If you don't believe me peruse the source yourself
hg.libsdl.org/SDL/file/

There's nothing intelligent going on because the GPU is only exposed through the driver.

Did that, turns out you get no rolls so I added an if statement to it. Thanks though.
Thanks. I don't have to rely off a shit variable giving me the same results each time and can now rely on dist(mt) alone by itself unlike rand();. I'm so glad you told me about this.

given an article, i need to extract keywords
is there a higher iq way to do this than grouping all the nouns and verbs?
theres probably some meme ML library out there

Prove it damnit. I want to see how bad this spaghetti code is.

I've posted in these threads for years. It's almost always the same feedback. No point to post code. I already know my place.

wiki.libsdl.org/SDL_CreateTexture#access

Directly disagrees with it being "impossible", but it has no code examples and is poorly written and that looks properly jank, defining rects that I plan on redrawing, redrawing them, then presumably doing something slow

Oh come on user, just one time for this newfag.