/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous Thread:

Other urls found in this thread:

steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
twitter.com/AnonBabble

I'm pretty sure monads are one big joke FP programmers made up

Reminder that the argument still stands and has not been addressed:

A sequence of computational steps is a program.
Metaprogramming is the act of treating a program as data and transforming it into a new program.
Any usage of bind amounts to chaining computational steps.
Bind can (potentially) redefine the way binding works and the way computational steps are sequenced, effectively producing a different program from the one implied by the original sequence of computational steps.
Therefore monad usage is a form of metaprogramming.

first for chash comfy

Learning multithreading
#include

#include
#include
#include
#include

#define TIMES 10

atomic_bool canTock;

static int start(void *arg) {
for (int i = 0; i < TIMES; ++i) {
while (atomic_load(&canTock) == false);
puts((char *) arg);
atomic_store(&canTock, false);
}
return 0;
}

int main(void) {
atomic_init(&canTock, false);
thrd_t t;
assert(thrd_create(&t, start, "tock") == thrd_success);
for (int i = 0; i < TIMES; ++i) {
while (atomic_load(&canTock) == true);
puts("tick");
atomic_store(&canTock, true);
}
thrd_join(t, NULL);
}

How do I make vim comfy?

forgot to make canTock static

install code::blocks

Currently I'm writing python script for deploying, I hope it to work quite like Ansible.
What do you think? Should I make the repo public on jewhub?

Monads are forms of programs with binding in the same sense that monoids are forms of programs of instructions or comonads are forms of programs with binding or monadplus' are forms of programs with binding and failure, or monadzip's are forms of programs with binding and parallelism or applicatives are forms of programs with a more "limited" form of binding or monad transformers are a form of forms of programs that transforms another form of program

In the end nearly anything can represent a program, a pointer can, a basic data structure can, a number can, etc.
Something that takes one string and turns it into another.
If the context is that both of those are paths to programs then it's suddenly metaprogramming

this seems a rather useless sense of the word

>In the end nearly anything can represent a program
A function that computes something is a computational step, especially when you have plumbing that takes the value (or something derived from it) and passes it on to the next step.

>not actually addressing the argument
Try to quoting the premises you disagree with and explaining why they're wrong.

how did i say you are wrong? you are write, and numbers are also programs, and so are pointers, and data structures, and strings, and transformations of strings regardless of whether the transformation itself is considered a step - the strings themselves are the steps i'm talking about.

this post is a program for the human brain to run

>hurr durr everything is a program
A list of numbers may or many not be a program, depending on what you do with it (it can be interpreted as a set of instructions). The functions you pass the the monad's bind operator have an explicit meaning as a computations in Haskell.

you pass lists to bind in haskell, and use them in do notation, etc, they are programs that perform branchign

obviously this is the monadic sense, but they're also monoids and so you can think of that as being a sequence of instructions

Does anyone have a good reference for making my C++ data structure thread safe using STL? I don't want to use Boost and I'm on C++17

Oh god, I hate those people. The word monad basically doesnt mean anything anymore.
This is what we get for letting normie programmers in.

I think the term you're looking for is DSL?

moreover if you are convinced that only functions are computational steps then surely all higher order functions are metaprogramming?
bind is different to fmap after all, and consider cobind from comonad
it seems what you really mean is higher order functions, which are much more general than the monad type class or derivatives, or comonad or functor etc

and i'd say it's wrong because you can clearly represent computations without functions, and have functions like "id" or "()" which DON'T really correspond to computational steps, certainly not in optimised code at least

that is they don't really correspond to compiled instructions, beyond obviously the instructions you use for all functions

For my dissertation I'm working in the field of data mining. I'm doing a research project and a report for part of the dissertation, but I'm going to produce some piece of software for the second part. The trouble is I suck at coming up with ideas and was wondering if anyone could give me some novel ideas for a piece of software related to data mining // data analysis and maybe machine learning.

>you pass lists to bind in haskell, and use them in do notation, etc, they are programs that perform branchign
The lists themselves are not a sequence of computational steps. The functions you pass to bind are the computational steps. Again, this is different from saying that any list is a program because those computational steps have explicit meaning as computations, and they can and do get executed in Haskell.

List is a free monoid. The "," is the operation.

And, of course, every monoid/group/ring/etc is a monad. If that matters to you.

>if you are convinced that only functions are computational steps
I never said only functions are computational steps. I said the functions you pass to bind have explicit meaning in Haskell as computations, and the way they get chained into longer computations implies that they are, in fact, computational steps.

>then surely all higher order functions are metaprogramming?
No, because not every use of higher order function treats them as a sequence of computational steps to be transformed.

You are not actually addressing any part of the argument, and this is getting really boring.

as I said before, you are under the misimpression that only functions are computational steps, that all functions are computational steps, and that only monads act on functions

Oh no, im not that person. Im just drive by nitpicking y'alls argument.

>you are under the misimpression that only functions are computational steps
That's a lie,

>that all functions are computational steps
That's a lie.

>and that only monads act on functions
That's a lie.

Since you have to resort to blatant lying and can't address the argument, I accept your concession.

i don't understand, you are both trying to argue that computational steps must and must not correspond to machine code

data Program = Stop | Print Int Program
is Stop not a program?
is Print 3 Stop not a program?

is Print not a statement AND a metaprogram, not a function and constructor that transforms one program and an int into another program?

>drive by
>y'alls
Should've known I'm arguing with a literal nigger or a wigger. Enjoy your double digit IQ.

>you are both trying to argue that computational steps must and must not correspond to machine code
You're simply lying again.

Porting my discord bot from C# to node. I need to be able to make quick changes to it while away from my development machine that has the source on it, and using rdp to the vps to change some text and relaunch node is much easier.

>if X is metaprogramming then Y is also metaprogramming because i say so
>this somehow proves that X is not metaprogramming
What are you even trying to achieve?

how am i lying? i have read your post and analysed what your argument entails

what do you mean? what have i said isn't metaprogramming?

you go to tpope's github and install everything that seems good to you

don't need any fancy tricks like monads to make a program

>i have read your post and analysed what your argument entails
Quote the part that says anything about machine code at all, then.

>what have i said isn't metaprogramming?
What are you trying to achieve? If your contention is that any data transformation is metaprogramming, then that's trivially false, because not all data represents a sequence of computational steps.

why are you so opposed to abstraction even in argument form? if i just think about what your argument entails, you accuse me of lying because it isn't exactly what you've said, it's just something implied by it
your idea of an argument is you in totalitarian control over what can and can't be said
that isn't discourse, you are treating discussion like a classroom

>not all data represents a sequence of computational steps
you could make a point that it does, that even persistent memory is to be read and will affect the running of future programs, but ignoring that

i didn't say any data transformation, but i gave loads of examples
as i said, surely you think higher order functions are meta programming? that actually matches your idea of binding nicely, since that's what functions do

in the end, your points about monads are just silly because everything you say can works with applicatives too, and all sorts of other abstractions

>you accuse me of lying because it isn't exactly what you've said, it's just something implied by it
I accuse you of lying because you repeatedly claim that I "imply" things that I never did, and you consistently fail to explain how anything I said "implies" what you're claiming.

>your idea of an argument is you in totalitarian control over what can and can't be said
You can say whatever you want, but if you keep pulling arbitrary assertions out of your ass without explaining how they follow from anything I said, they'll be dismissed as your hallucinations.

look i group your posts together and see commonalities and say that and you call me a liar

you are manipulative and controlling - you even attack me for saying this, and say that the reason you are complaining is because you haven't explicitly said you're manipulative and controlling!

Can we just agree that whether or not monads or anything relate to metaprogramming is unimportant and all anons should stop discussing monad-metaprogramming immediately?

>you could make a point that it does
No, you can't.

>as i said, surely you think higher order functions are meta programming?
But you're lying again, because I've already explained why I don't think that and why it doesn't follow.

>in the end, your points about monads are just silly
Nice "argument", but that's to be expected from a negro.

Okay. So you can't address the argument. I accept your concession, you braindead nigger.

Here breads have gone from somewhat productive with a bit of humor mixed to unfunny memes, unfunny reposts bordering on automated spam, and teenagers arguing about shit that doesn't matter

Did the oldfags relocate?

multithreading my asteroids game

It's mostly just shitposters honestly, they come here now and then from wdg and avgv.
The main difference is that with less users, now 1 or 2 shitposters will completely cripple a thread.
The best solution is not to reply to them.

What is bad about OOP?

>What is bad about OOP?
The fact that it doesn't have any clear meaning, doesn't advocate anything concrete, and as a consequence, cannot have any concrete benefits and cannot be adequately analyzed or criticized.

Name-based-programming

Can we just agree that monads are unimportant?

I will not further respond to your attempts to derail the thread. This is the last reply you will receive.

What are the alternatives

read this
steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html

Pure imperative programming, procedural programming, functional programming, logic based programming, etc.

It's worth noting that a lot of "OOP" languages are C derivatives and are almost as much imperative and procedural as they are OOP

BASIC

by "pure imperative" i mean "just imperative" or "solely imperative" i.e. "purely imperative" not pure as in no side effects

>What are the alternatives
Alternatives to what? Doesn't seem like you understood my post.

need good news sites or groups that lets me keep up with the newest shit in the industry, tips?

Hello guys, is it possible to use an php script to add lines in html?

I want to make user1 go to page1 and user2 go to page2 but I don't really want to open up my file editor every single time I register a new user, may anyone help me?

>Pure imperative programming, procedural programming, functional programming, logic based programming, etc.
What's the benefit of dogmatically avoiding objects when they adequately represent the problem?

Why do you act as if OOP is the norm and everything else is dogmatic avoidance?
And I'd like to see where objects represent the problem better than an advanced type system.
Remember that objects are not just structs.

>Why do you act as if OOP is the norm and everything else is dogmatic avoidance?
Why are you literally lying?

>And I'd like to see where objects represent the problem
Whenever you're trying to model an actual independent entity.

> better than an advanced type system
Your demand is logically incoherent.

You are the shitposter from before, trying to derail the thread again.
Please leave.

You're an autistic sperg who consistently fails to address the point. Please keep it up. It's nice to feel superior.

What language

Which industry?
Programming isn't really 1 industry, honestly.
You have video game programmers, web devs, software devs (some intersection with game programmers), people who are specialised, etc
They blend at the edges but they're distinct enough that news would be different

What sort of news are you interested ni?

C

so I am trying to make video streaming program between 2 pc and I am little bit lost here . Let say that the average size of the image is 38KB. Should I just send the whole image in one piece no header no spiting to smaller packets just the raw image and then when it arrive check if its not corrupted if it is, just forgot it and take another. Or I will split the image to the smaller packets of size less than 1450b so the network card will not fragmented them, also I will add header to every packet where will be the size of the whole packet and number of section - so I will know how to assembly them when they arrive. If some of them will be missing or will have incorrect size i will just send message to the client to send them again. Some better idea?

Just because you don't do object-oriented programming doesn't mean you don't use objects at all.

A struct is not an object

This has nothing to do with OOP.

Fascinating.

The nonsense of the OOP cultists that will demand that anyone who puts two things together is an OOP programmer

Why are Haskell brainlets so retarded? Whether something is an object or not has nothing to do with how you implement message passing, what syntax you use, whether or not you use make use of the type system, and whether or not you can reuse the message response code with something else.

>OOP cultists
But you're the cultist, Haskellite trash. No one in this thread argued that whenever you put two things together, you're doing OOP, or that you should always use objects or do OOP. You're the one sperging about your religious dogma of avoiding objects at all cost.

Haskell doesn't have structs

Did I say anything about Haskell having structs, retard?

Haskell doesn't have structs

software and webdev mostly

>responding to his own schizophrenic hallucinations

Who is raiding us right now? They're even worse than javafag

Haskellfags

Ah yes, the Haskellfags raiding us with their metaprogramming and their OOP

naisu

>implying anyone was "raiding you with OOP"
>implying you didn't start sperging about how you should never use objects because muh type system (as if that even makes any sense)

No, Haskellfags are raiding us with useless functional programming.
Imperative programming is what the industry used since it was born.
OOP is fine too, I guess.

Which industry?
And no, there are several regular Haskell users in /dpt/.
The raiders are angry that there is anyone in /dpt/ that dares to use Haskell or even not claim to be an OOP dev

Game engine development industry, for what I'm concerned.

>you should never use objects because muh types
>y-y-you're just angry because everyone doesn't do it your way religiously

Just thought of an interesting feature for languages with records (commonly known as structs). Allow the user to abstract over labels when constructing a record.
You can implement default initialization:
record Foo {
bar : Int,
baz : Float,
qux : *Foo
}
// assume default is defined for Int, Float, and *A
defaultFoo = Foo { x => default }
partiallyDefaultFoo = Foo { bar = 100, x => default }

You can implement zipping:
zip f o1 o2 = Foo { x => f o1.x o2.x }

You can easily implement subtyping:
record Base {
bar : Int,
qux : *Foo
}
fooToBase o = Base { x => o.x }

This is the daily programming thread, not the advanced game engine v development thread or whatever it's called.
It's for all programming discussion, not just for the gaming industry.

This is the pinnacle of programming language, you may not like it but this is the peak of programming language performance

Pascal assignment. Shitty and old language but i fucking college i guess.

Sometimes these are called labels, are you implementing label polymorphism?
Obviously there are bad performance implications for rank-n label polymorphism

>download (1).jpg
FP toddlers are truly retarded

Shame about +. and multicore

Pascal is 47 years old, /dpt/, say something nice about her!