/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

techbeacon.com/revisiting-forgotten-code-constructs
en.wikipedia.org/wiki/Corecursion
twitter.com/NSFWRedditImage

First for ATS

Please post a Norway image next time.

The ideal programming language for me is a type theory that is the specification of an abstract machine.

...

Sixth for 1-based indexing

P ≠ NP.

what is the most anti-pajeet language out there?

techbeacon.com/revisiting-forgotten-code-constructs

Bring back programming with chainsaws and hand grenades.

Haskell

...

Not a proof.

What kind of type theory?
Absolutely not.

>goto
>recursion
>eval
>multiple inheritance

Yeah, maybe those look like "chainsaws and hand grenades" to a girl

...

Still true to this day
Still people deny

>recursion
>forgotten
Only if your CS education was shit.

eval is just plain garbage. The rest are fine. But the principle of the article is why I say chainsaws and hand grenades.

>goto
Too powerful.
>recursion
No general recursion. Provably terminating recursion is fine.
>eval
>multiple inheritance
No comment.

Recursion is not as clumsy or as random as a loop, but an elegant tool for a more civilized language.

can someone help me debug this? it infinitely shuffles the same couple numbers around

def max_heapify(A, i, heapsize):
while i A[maxi]:
maxi = l
if r < heapsize and A[r] > A[maxi]:
maxi = r
if maxi != i:
tmp = A[i]
A[i] = A[maxi]
A[maxi] = tmp
i = maxi
else: break


here's the whole program
def parent(i): return i // 2

def left(i): return i * 2

def right(i): return (i // 2) + 1

def max_heapify(A, i, heapsize):
while i A[maxi]:
maxi = l
if r < heapsize and A[r] > A[maxi]:
maxi = r
if maxi != i:
tmp = A[i]
A[i] = A[maxi]
A[maxi] = tmp
i = maxi
else: break

def build_max_heap(A):
heapsize = len(A)
for i in range(len(A)//2, 0, -1):
max_heapify(A, i, heapsize)

def heapsort(A):
build_max_heap(A)
heapsize = len(A)
for i in range(len(A)-1, 1, -1):
tmp = A[1]
A[1] = A[i]
A[i] = tmp
heapsize -= 1
max_heapify(A, 1, heapsize)

Ideally, homotopy type theory. Until we get better at computing HoTT, observational type theory.

Did you just call undecidable garbage a "civilized language"?

i want to:
use my shitpost bot, make an instance of it and bind it to a proxy from a list

make multiple of these instances, so that means bot will get its own unique proxy ip

while shitposting, if a proxy gets banned while shitposting, get a new proxy and set it to the instance

>undecidable
>garbage

Pick one
Decidability is for faggots.
It's gay.
Not-straight.

Well I wasn't going to call your mom it after what we did together.

Undecidability is quite literally for cuckolds.

Of course, if an even more expressive type theory than HoTT comes around, I will be all over it.

>Too powerful
No such thing. Problem with goto is that it leads to spaghetti code. It has its uses, however.

>Provably terminating recursion is fine
Non-terminating recursion has its uses. Many programs are designed to run forever, or at least until they get hit with a Ctrl+C or a click to the close button on the window.

>make false statement without proof

I have to agree with Ruby here. Provably productive corecursion is fine as well.

It is a proof. I have already submitted it to the Clay Mathematics Institute.

I posted about an alarm clock a few threads ago. Thank you to the user who suggested sleep_until, it does what I need it to do. Next step is to make it wake the computer from sleep. I think I'm supposed to use waitable timers.
int main()
{
using std::chrono::system_clock;

// sleep time in seconds
std::chrono::duration one_period(1);

system_clock::time_point today = system_clock::now();
system_clock::time_point tomorrow = today + one_period;

std::this_thread::sleep_until(tomorrow);
system("start firefox youtube.com/watch?v=-Tdu4uKSZ3M");

return 0;
}

@60186111
Is the female mind simply incapable of understanding coinduction and corecursion?

Damn. Why is Maki so perfect?! Also how is everyone defragging their compiled syntax shells? I can't seem to be able to shift the vector files properly.

>provably terminating
>corecursion
pick one sweaty xx

Threadly reminder that dlang-chan is not dead, and she's super duper cute and fast! Say something nice about her, /dpt/!

>Why is Maki so perfect?!
But she isn't. It's all because of those chest tumors of hers.

Get that trash off my board.

That's not Maki

rip

Please don't litter.
Put that garbage in a bin.

Fuck off. Ugly rats trying to dethrone the queen. It's despicable.

Your endless shilling is tiresome. Look: I'm a NEET too, but I don't spend my time spamming one of the worst idols in existence. Get some taste, faggot.

Arguably, most good programs involve potentially infinite loops. Consider the case of a compiler: it loops until it reaches the end of a file, but suppose I were to develop a device file similar to /dev/zero or /dev/random, but which will spit out an indefinitely long stream of valid C code. Presuming we did not overflow any internal buffers, a program like GCC would invariably run forever.

You don't even need that. General recursion that can go on forever and not be proven to ever terminate without the user explicitly killing the process, is perfectly acceptable behavior, and is in some cases, necessary.

I wouldn't know. I am neither female, nor an expert in psychology.

>xx
Was this supposed to be an incomplete omega combinator?

someone please respond

No, it's provable whether or not it terminates.

>General recursion that can go on forever and not be proven to ever terminate without the user explicitly killing the process, is perfectly acceptable behavior, and is in some cases, necessary.
Also known as productive corecursion.

@60186191
>You don't even need that
Yet again you have proven yourself to be a subhuman of the highest order. Keep it up.

Dude just change the biometric tag to a variable that is greater than the value of your limiter, not that hard. Fucking kys

nm i'm a fucking idiot

A term that I have only ever heard in /dpt/. Please get a degree in computer science so you can use the same terminology as everyone else in the field.

For: 60186243
Maybe it has something to do with your shit """"""""education""""""""

>In computer science, corecursion is a type of operation that is dual to recursion.
>Where recursion may not terminate, never reaching a base state, corecursion starts from a base state, and thus produces subsequent steps deterministically, though it may proceed indefinitely (and thus not terminate under strict evaluation), or it may consume more than it produces and thus become non-productive.
en.wikipedia.org/wiki/Corecursion

Ruby confirmed for stupid girl who doesn't understand basic compsci

If you Google the phrase "productive corecursion" (in quotes, so the two words have to be together to be found), you'll find a total of 37 results, of which, 4 come from archives of Sup Forums.

fixed it, one big stupid bug and a couple little ones about boundaries. here's the working code if anyone is interested or working on something similar
def parent(i): return i // 2

def left(i): return i * 2

def right(i): return (i * 2) + 1

def max_heapify(A, i, heapsize):
while i A[maxi]:
maxi = l
if r < heapsize and A[r] > A[maxi]:
maxi = r
if maxi != i:
tmp = A[i]
A[i] = A[maxi]
A[maxi] = tmp
i = maxi
else: break

def build_max_heap(A):
heapsize = len(A)
for i in range(len(A)//2, -1, -1):
max_heapify(A, i, heapsize)

def heapsort(A):
build_max_heap(A)
heapsize = len(A)
for i in range(len(A)-1, -1, -1):
tmp = A[0]
A[0] = A[i]
A[i] = tmp
heapsize -= 1
max_heapify(A, 0, heapsize)

>139 results IGNORING Sup Forums
>this is ignoring anything that says "non-productive corecursion", "productivity and corecursion", etc
yeah sure

Even if you hadn't admitted in the same sentence that your evidence is flawed, that's still not a very convincing result.

Prove it.

Instead of your shitposting, I have a better idea: let's all love Lain. Let's all love Lain!

why arent you using namespace std;?

I like this acknowledgment that Ruby is female.

did you just assume the gender i intended "sweaty" to have?

>139 results
Go to the 4th page, and you will find that they remove redundant results, giving only 37.

Also, if you ignore the domain Sup Forums.org, you're still going to get stuff from rebeccablacktech and warosu, which are archives of Sup Forums.

Where did I admit that my evidence is flawed? The very fact that the two words are only used together on such a very small number of web pages suggests that it is not common terminology in computer science.

No, I accidentally referenced your post instead of the one I intended to reference.

Wouldn't left child be i*2 +1, and right child i*2 +2?

Parent should be (i-1) // 2

Look up corecursion, then. You should be able to figure out what productive corecursion is once you understand what corecursion is.

There isn't any reason not to as far as I know. I actually don't know what the using std::chrono::system_clock; does. I saw the keyword "using" and assumed that it said "using namespace".

Fun face: there are no men on /dpt/, only women pretending to be men.

I'm a girl, but only when I'm wearing a skirt. :3

Call me female all you want; it won't make it true. I'm a 25 year old man with a balding spot on the top of his head; hairy arms, legs, and chest; and an unkempt beard. I have male genitalia and chromosomes, and I identify as male. There is absolutely nothing feminine about me.

When you're not wearing a skirt, are you a furry?

so with lua

is there anyway I can alter a variable after calling a separate function within the same line of code?

Like I need to wipe the variable after it's used to call the correct function that should be next in the series.

or am I forced to clear it in the next function that's called? Suppose I can just use a secondary variable like X was used Clear X, kind of annoying though

No, i'm male.
Furries are degenerates.

>I'm a 25 year old man with a balding spot on the top of his head; hairy arms, legs, and chest; and an unkempt beard.
This is the sort of nonsense some women believe about men. It's obviously false. Nice try, Ruby.

"a blue cat and a red dog" has way fewer results than "productive corecursion" but I'm sure you can instantly understand the former phrase.

are you wearing a skirt right now?

More fun facts: there are no women on /dpt/, only lolis pretending to be women.

Why are you using lua?

The purpose of the search is not to find out what the meaning is, but how often it actually sees use. Most people don't talk about blue cats and red dogs. Similarly, the fact that "productive corecursion" sees very few search results suggests that it is a particularly obscure term. That was the point I was trying to make -- that the term you are using is hardly used.

Love 2D to make a game, and it's the only language I know anything about

replying to you is unproductive corecursion

>That was the point I was trying to make -- that the term you are using is hardly used.
Well, that is the terminology. It's either that or use the whole definition every time.

I fucking hate faggot,trap and anime posters so fucking much. I wish /dpt/ didn't have this shit.

don't act like you wouldn't like to touch my smooth girly legs user ;3

Making my own game engine and now beginning to wonder whether its actually worth it or not...

Trying to put Lua into it and its just not happening. Not only do I not know what I'm doing or any resources for learning exactly what I want, but my pre-lua engine was never going to be good anyway. I started doing this to challenge myself and while I've learned wonders of SDL and OpenGL I don't really know how close I really am or whether I'll always be pretty shit

These errors are making me want to commit suicide been working all day and just as I finish getting rid of initial errors these appear :(

we all suck when we begin user, push on

assuming it's a research term, seems to me it could easily have few results because... it's from theoretical compsci research term not something like pop sci, why would you expect it to be heavily discussed in the internet?
can't you just do variable = 0 after calling the function?

Not programming.

I feel like my uni degree isn't going to prepare anyone, here I am sat up nearly every night watching anime and programming while people get drunk.

I'm doing my best but I think I'm in a bit too deep learning SDL (got it under my belt I think) OpenGL (meh, it works) and now Lua integration (tough going). I struggle but I guess thats how we learn

I have a feeling you're getting your errors due to the shitty linking system in Windows, you should try getting this done in linux instead

thanks, I'll do my best!

...

Learning C from C Primer Plus 6th edition, why is it that minGW gives me issues with
#include

int main(void)
{
float about = 32000.0;
double abet = 2.14e9;
long double dip = 5.32e-5;

printf("%f can be written %e.\n", about, about);
printf("And it's %a in gexidecimal, powers of 2 notation.\n", about);
printf("%f can be written %e.\n", abet, abet);
printf("%Lf can be written %Le.\n", dip, dip);

getchar();
return 0;

}


But microsoft visual studio is fine? the long double is completely fucked if I use something like dev C++, which is what I've been preferring to use so far, I find it simple and it works for small single file programs just fine.

is your mingw 32 bit?

When you say "also known as", there is at least some implication that a reasonable number of people know it by that term. My google search of the term demonstrates that this is not true. In reality, most people know of an infinite loop as simply an infinite loop, or infinite recursion.

If that were the case, one should at least see the phrase popping up in a few more journal articles, by a variety of authors.

I can do that in the second function yet, but in the game I'm trying to keep track of a hand

7 possible cards in the hand

so card 1 does X
use function to call card 1's function
clear card 1 because it was used

but "card 1" could be in any of the 7 slots.

so I could add in a this card was used variable, and an extra function to clear it

but If can clear it directly after it's used to call it's function in the same action, then that saves me tons of work/headache

I'm sure this makes no sense to anyone but me

and I'll probably just have to do it the long way

>getchar() at the end
Please remove this.