/dpt/ - daily programming thread

last what are you working on Any Forums?

Attached: 1651700249344.png (1920x1080, 2.64M)

Other urls found in this thread:

godbolt.org/z/MbadTrGhc
godbolt.org/z/33z7dbPTb
twitter.com/AnonBabble

the year of the zig will come one day...

i want to write my next project in zig the only thing stopping me is that i need to support CUDA
do i just write the core in zig and then somehow drop in cuda support later?

in case you dont see cause thread is old:

this is the full program:
godbolt.org/z/MbadTrGhc

this is just the function
godbolt.org/z/33z7dbPTb

ty for help

Attached: helgb.png (1464x976, 99.78K)

>what are you working on Any Forums?
Crippling loneliness.

Attached: 1624579941309.jpg (1024x1024, 136.29K)

Can I disable this notification?

Attached: file.png (903x84, 9.51K)

abandoned Python for Javascript for a small cinematics project that required animations. Call me webshitter but matplotlib is such a piece of obtuse shit holy shit.

spellchecking my crate's documentation and touching up my crate's lib.rs documentation/doctests

Attached: 0zbzic3yxkv11.jpg (2161x2161, 237.38K)

it's such a simple task pretty much all application create it themselves.
usually it's just a chain of if statements or if you want to over engineer, you could optimize the if statements away, but most C programs only care about size, since the whole application would be stored in a single file for simplicity (since many CLI apps are part of a library that implements the CLI apps function which makes the CLI app very empty, like for example libzip's ziptool and other tools or lua's command line tool).
So using a library would make the program unnecessarily complicated since now the single file program turns into a single file and headers + source for a opt library that could be self implemented in about 100 lines or so.
Also project args are a C feature, so using C to implement your arguments is perfectly fine and makes sense, no need to C++-ify if you don't need to.

I think the problem is that your inner loop doesn't fully go through the list because when you do a swap curNode is moved back.

Trying to write a DSL query language with nested queries that fetches results from a database as it is being parsed instead of after parsing is completed.
This but crippling self-hatred. I don't give a shit about other people.

>tfw installing boost via vcpkg and it's storming outside

>mfw the power goes out halfway

Attached: ero.jpg (1080x884, 78.27K)

Is it stupid to do image processing by making an opengl context, writing a processed texture to the screen, and saving the result? The hardware acceleration is good but the overhead of setting everything up seems to be long

you should be using opencl or you could do it using the CPU for portability like a library or something.

yo linked list boy

gonna break it down a bit more
size_t count_list_elems(CharList_node **list)
{
CharList_node* curNode = *list;
size_t count = 0;
//curNode will be one past the end here
while (curNode != NULL)
{
curNode = curNode->next; //count how many items are in linked list
count++;
}
return count;
}
//order nodes in list smallest to largest
void order(CharList_node** list)
{
//basic null check
if(list == NULL)
return;

size_t listElemCount = count_list_elems(list);
CharList_node* curNode = *list;

I should note that the entire program is meant to process an image, it's not part of anything bigger. Would OpenCL still be a better option?

what have YOU made with functional programming and (mainly) prolog?

what are your thoughts on it?

is squeak/smalltalkVM for mentally retarded people? i get its uesd in some things like banks

>functional programming
>logic programming

well what do YOU think?

I don't know anything about openCL other than it's not for displaying graphics, but I guess if opengl works, you don't need to fix what works.
Personally I think processing an image on a CPU using a library would be better just for portability.

C# is a language designed by people who cannot see beyond the immediate problem to be solved. A jumbled mishmash of features added with a lack of joined-up thinking or forward planning.

Functional programming is the most reasonable way to program. Pure functional languages are generally amenable to analysis via operational semantics.

This but remove #

>Trying to write a DSL [...] that fetches [...] as it is being parsed instead of after parsing is completed.
Why does it matter that it is done "while being parsed" ?
It shouldn't change the semantics, it's ""strictly"" an implementation detail. And I guess it's an optimization.
Basically that's a single pass-compiler.
Except that here it's not a regular general PL, but a database language. And there are a shit ton of database optimizations.

This, and also read the dragon book.

Not yet but I'm learning stuff to do it

Computer Science becoming polluted with Software Development is one of the greatest tragedies in academia.

it depends on your algorithms, if they're easily parallelizable then sure otherwise it's probably not worth it

>Why does it matter that it is done "while being parsed" ?
So that I can do it in a single pass instead of having an intermediate structure. It really doesn't matter all that much. And I mentioned it's a DSL, it's one part of a program I already have so its use case is very limited. I don't need to read a book on compilers to implement it.

Okay so you have the outer loop iterating over each node in the linked list, and the inner loop iterating over the array pointed to by the nodes right?

Should be documented with such terminology.

suppose i want to program FPGAs

would running through "verilog by example" be a good start? i've seen the /sci/ textbook memes but let's be real i'm not going to run through 2000 pages worth of textbooks. i'd probably read the first few chapters then give up after the third problem set

You'll get yourself into a mess trying to write a single-pass compiler. Streaming might be a way for you to handle this. Yes, you'll have intermediate data, but you might be able to avoid holding the whole intermediate structure at once.

>I don't need to read a book on compilers to implement it.
You're merely delaying the inevitable.

It's really not as complicated as you think it is. It just collects sets of PK's from the database based on a part of the query then combines it with the result of the next part of the query and so on. The nested queries can be handled with recursive parsers and other than that, the clauses of a query can be processed serially without any real trouble. I already have a multipass version working but figured I would give this a try.

what kind of stuff