/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1559093095399.png (1280x720, 1.01M)

Other urls found in this thread:

hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:partition
rosettacode.org/wiki/Loops/For_with_a_specified_step
dlang.org/library/std/range/iota.html
redox-os.org/
twitter.com/AnonBabble

I'm answering questions from newbs.

Attached: turtle, cute.png (700x528, 677K)

Guys I'm trying to write a C++ function that determines if another function will enter an infinite loop or not, any tips?

is this a good place to start for C multithreading?

Attached: u027.jpg (407x500, 29K)

I fucking love bocchiiii~~~~~~

Attached: bocchi.jpg (1280x720, 74K)

first for erlang

Read "Abstract Interpretation" by Cousot & Cousot.

Somebody once proved this is impossible, at least for the general case. Now stop trolling.

Why yes I use eta lang on backend, how could you tell?

Attached: 1001004006217508.jpg (912x1024, 71K)

Wouldn't that just assign both i and j to the same element of a list?
I'm talking about when you have some sequential structure like a hash table, you can do
(for ([(key value) hash-table) ...) if your sequence returns multiple values per iteration.
Look up termination analysis. There's tons of theory on it.

reading up on X11. it's kind of a mess.

make sure to test it on itself

What is a good resource for learning C in depth for someone that is already an experienced programmer? Used C++ mostly in college and now I use Python at my job. I'd like to learn C for that low level exposure but most resources start out with a lot of CS basics and assume the reader doesnt know anything about programming. Would like a more accelerated approach.

Making a simplified HTML parser

I love fucking b

no, read a book dedicated to parallelism/concurrent programming. Then look up the corresponding c libraries for each of the techniques or paradigms if the book you picked doesn't use C.

Attached: IMG_20190331_103927.jpg (1201x1700, 177K)

Attached: download.jpg (196x257, 11K)

Thanks user. Does this only cover pointers or other parts of the C language as well?

then skip the paragrpahs or chapters that you already understand.
Or pick a book a more specialized subject (systems programming, data structures/algorithms, etc.)

make sure to use regex

Like this?
(for [[k v] {1 "one"
2 "two"
3 "three"}]
...)

I don't know what they call it in Racket but in Clojure we call it destructuring.

And that gay man's name? Alan Turing

Any recommendations on the latter?

sorry I'm just dreaming up a language like a loser. I came up with
int[10,10] x
for every 2 i in 1..10
for every 2 j in 1..10
x[i,j] = y


does that make sense?

Nah, it's C++

Attached: 1559342058350.gif (660x780, 201K)

It goes into some details on memory itself and how the footprint of arrays/structs looks like apart from pointers themselves. For other aspects of language just pick a book for that aspect.

i was meming
you can't parse HTML with regex because HTML isn't regular

>any tips?
Install a language with actual totality tools like Idris.

(for ([(k v) (in-hash ht)]) ...)
in racket

for me, it's two robot dildos. But I think four will be better. So just wait a few more hours

Attached: doublepenetration.jpg (3000x2000, 497K)

Concurrency in practice for Java was just fine. The principles always peek through the library specific stuff

show me your partition, Jow Forums
partition :: (a -> Bool) -> [a] -> ([a], [a])
partition f = foldr (\x (as, bs) ->
if f x then (x:as, bs)
else (as, x:bs))
([],[])

Which is better, traditional multi-threading or a system where you start tasks and wait for them to finish, while letting the OS or an underlying system handle which thread calculates which task?

looking good, user. which 3d printer are you using?

ender 3. This printer is fucking based. The only upgrade I did was a glass plate, but other than that it is just perfect (for PLA printing).

what is it supposed to do?

>every 2
do you mean a step?

hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:partition

"which is better" always depends on your use case

What? The OS is going to have no idea how to divide up your problem between threads, all the OS can do is schedule threads to run, you're the one who needs to implement how work is divided up.

What it sounds like you're thinking is it better to divide up the task at the start into n pieces and just let each one do 1/n of the work, or have some form of "work" queue that jobs pull from. If this is what you mean in generally the later is better because it leads to less idle time of threads, assuming your process is the only one running, and that tasks may take unequal amounts of time.

Does that work by pattern matching or is 'destructuring' something specificically defined for each sequence? If it's the latter I guess Clojure does the same thing as Racket, just with less parens.

what do you guys think of perl? i've been reading about it and it think its well designed based and redpilled why people doesnt use it anymore?

yeah so every other cell in every other row of the array will be assigned

he's talking about a job scheduler

calling it step instead of every would be less weird. also you might find this interesting:
rosettacode.org/wiki/Loops/For_with_a_specified_step

"for step" is not a real sentence

for i in 1..10 step 2

has any of you ever made use of google api, and more specifically, google sheets api? question, will authentation work with offline websites? like, I want to get spreadsheet data, but I don't want to host my website.

In D this is just
[1,2,3].stride(2)

does linux have any modern "standard" programming language like Windows C#?

Attached: IMG_20190420_175635.jpg (768x1024, 154K)

>stride
it's garbage, look at when it has a word they all call it either "step" or "by", then here comes your gay language with "stride"

c++

I love bocchi cunny

Attached: aru song youtsuba smile.png (960x600, 305K)

It will expand to something with the same effect as
(for [kv {1 "one"
2 "two"
3 "three"}]
(let [k (nth kv 0 nil)
v (nth kv 1 nil)]
...))

The logic behind destructuring in this case is "square brackets mean vector literals and vector literals mean to destructure using nth."

>no gui builder
>the only good IDE (clion) is paid
>no package manager
yikes!

Well, there's also
dlang.org/library/std/range/iota.html

iota is fine too

Clion (and other jetbrains shit) is utter garbage.
Use QtCreator.

Why do all the UI libraries for Java suck dick. I can't believe there's no way in Javfx to communicate between controllers without having to use and FXML loader to pull an instance.

I just want some sort of message passing or emit functionality to be able to communicate without having to load random shit again.

Because Java sucks dick, stop using it.

Isn't FXML just tacked on?

Don't blame systems for you not knowing how to use them.

Qt Creator is the best IDE bar none.

What is the "right" way then because everything I've seen online just looks obtuse.

What does it have over N/Vim?

>Go to install Clang on a fresh windows install to compile some C
>"Clang error: Could not find Visual Studio install path"
wut, why would clang need visual studio build tools?

Attached: 1476413204558.png (649x649, 296K)

>Windows
More like wwwwwwwwwwwwwwwwwwindows

windows sdk?
microsoft linker?
>what is a c runtime

Everything. Try it sometime, I promise you won't regret it.

what made you think building on windows was possible with pure free software? your best choice is mingw as far as I know. it's the only fully foss toolchain for windows, I think. All I know for certain is that mingw does not depend on any msvc distribution.

>full llvm toolchain doesn't have a crt* for windows

is this for real? lmao. wincucks are the worst.

"everything" isn't a valid answer.
give me three things atleast.

windows is propriety software, all the system calls are abstracted under the windows's API. your fault for not adopting gpl software.

I have though. I'm not a wincuck at all, nor an apple shill.

What does /dpt/ think of Haiku OS?
Any other ready to install pre 1.0 OS's i should try?

waste of time and energy. be os is dead and obsolete technology now, time to accept it.

Eh, I think it's fun to have a side-project, plus it's kind of nice working in a tiny OS.

I don't know why Jow Forums doesn't collectively love Rust. It's an amazing language.

>modern C++
>god tier package and build tools (cargo)
>no classes or OOPsie bullshit
>functional programming flourishes
>next step in the RAII evolution
>as fast as C/C++

All I see are memes yelling "HURR DURR TRANNY LANG XDDDDDDDDDDDD" and the occasional poster complaining about the borrow checker. Fuck off.

Attached: rust.png (500x656, 159K)

>finish uni and stop programming for about 9 months
>decide to try to make an app to see how rusty I am
>remember precisely nothing from all my time in uni
Fuck. How does this even happen? I don't remember syntax, I don't remember how to make methods work, I don't even remember how to make a fucking clickable button. I'm starting over from square one and it's made me regret ever going to university to begin with. Having to learn everything again but without university resources is going to be a fucking nuisance.

yeah but haikuos is far from being a side-project, it's just too big to maintain to compete with other OSs. Prefer GNU Hurd or serenetyOS

>finish uni and stop programming for about 9 months
Why did you do that?

Are you trolling? You'll relearn it ten or a hundred times faster.

not as mature as C++ in its feature set and the borrow checker makes it a pain in the ass to do anything useful
syntax is arguably worse too, but that's bikeshedding
fix this and I'll come over

There are reasons not to use it, e.g. if GC is fine for your project. The real mystery is why people want to spend their time complaining about languages they don't use.

Towards the end, I was programming for about 16 hours on average every single day for a month straight because of a fuckup that meant I had to squeeze 8 months worth of work into a month and I was burned out beyond all measure. Even got RSI bad enough to explode my tricep, which then slowed my programming even further. Total shitshow.

We'll see. I honestly just feel lost. It's like the first time I ever picked up programming tbqh. Gonna have to find a few basic courses or tutorials or some shit to run through, read some documentation, bring myself up to speed again. It's just frustrating and a bit daunting, but sure, that's life.

It's even more disgusting to look at and write than sepples.
The borrow checker gives linear types a bad name.
I'm waiting for Idris 2, since it won't have any gimmicks.

the serenity code looks more approachable than any other OS i've seen

redox-os.org/

it has been scientifically proved that rust code is more readable than C or C++ code.

>tranny communist trash
no thanks user

>borrow checker makes it a pain in the ass to do anything useful
The borrow checker is the "right" way to do things. I.e. it's the safe and proper way to handle memory. Eventually you'll learn to flourish with it.

>not as mature as C++ in its feature set
Explain?

Templates are the king of disgusting. Rust looks a lot nice than Sepples garbage.

lad, no matter how safe rust is, nobody wants to fucking write and maitain a code base written it, not even rust devs. It's not an enjoyable language to use.

>Rust looks a lot nice than Sepples garbage.
Not really, considering Rust kept awful shit like s

It's simply too coarse. You spend most of your time worrying about how to inform the borrow checker you're correct than just writing correct code. The fact that you can't have multiple mutable references to an object even in a single threaded environment is utterly absurd.
Restrictive generics, No HKTs, weaksauce const fn, underpowered move semantics (no way to handle back pointers or in fact any kind of nontrivial move), no specialisation... nearly every feature that might be useful is unstable yet Rust seems intent on breaking compatibility even with stable features *and* making code needlessly verbose with shit like dyn Trait.

tfw no visual studio on linux
c# is comfy but mono develop / vs code is shit

Attached: 1539468125707.jpg (645x773, 131K)

>vs code is shit
If you aren't used to Vim and have more than a few gigs of RAM, VSC is fine.
I still want to write a replacement in it using Vulkan someday though.

Why is Facebook and Google actively using it then?

>see this
what do you do /dpt/

Attached: choose_your_character.png (469x570, 16K)

>VSC is fine
how do I make gui application using vsc and c# then?

>vulkan text editor

Attached: bathingwithsakamotocrop.jpg (401x225, 16K)

please help I am too dumb for this

I have 2 3d positions (x,y,z)
I have the distance between them
Every loop iteration I wanna move the object that was in the first position towards the second position by k distance
now ofc linear movement looks like shit
and I cannot wrap my head around how to calculate it to accelerate and then slow down
so essentialty how do I calculate the k distance for each iteration
I tried using trigonometry functions but I just cant' connect this
I'm sorry I never get answered on /sqt/

Attached: denied the pleasure.png (1000x1000, 61K)