/dpt/ - Daily Programming Thread

Join #dailyprog on freenode; What are you working on, Jow Forums?

Previous thread:

Attached: Screenshot_2018-09-26 g - dpt - Daily Programming Thread - Technology - 4chan.png (3328x740, 147K)

Other urls found in this thread:

msdn.microsoft.com/visualfsharpdocs/conceptual/collections.map['key,'value]-class-[fsharp]
discord.gg/4TuhPhr
twitter.com/SFWRedditVideos

First for Haskell

Working on my resumé.

>pre bump limit
>freenode shilling
>non anime OP

Attached: mayAllahForgiveMe.png (675x477, 275K)

can someone shed some light on the runtime of this algorithm?

arr = some array of size n
k = some constant
for (i = arr.length - 1; i >= 0; i--) {
if (i >= k) {
for (j = i - 1; j >= (i - c); j--) {
// do some constant operatior
}
} else {
for (j = i - 1; j >= 0; j--) {
// do some constant operation
}
}
}

it doesn't look O(n^2). since the amount of iterations for the inner loops cannot ever be N on all iterations as they are bounded to be less than the current iterator, which is constantly decrementing

what's c? inner loop in true branch is O(c), in false branch is O(k)

>What are you working on, Jow Forums?
After like a weeks of not doing anything I finally continued on my strategy game.
You can now spend labor points (1 citizen gives 1 labor point each year) to produce goods. I'm also trying to prepare for adding trade, which is the meat of the game.

I'm a bit stuck though.
Production, Import and export is each a list of tuples in the shape (resource, quantity), I want to add together each resource in production and import, and then subtract the resources from export.
I managed to subtract from export using a loop, but I can't figure out how to add together imports in a nice way.
The problem is that in exports, I know that all things I export already exist in the list. For import, I first need to check if the resource exists in the production list, in which case I add it to that total, otherwise add a completely new post. I worked on this a bit and I can do it, but the code will end up looking like total shit. Anyone have a good suggestion on how to merge these lists? Coding in F#

Attached: Capture.png (1704x895, 53K)

msdn.microsoft.com/visualfsharpdocs/conceptual/collections.map['key,'value]-class-[fsharp]

sorry c is supposed to be k

hmm, yeah. I should probably just make a map out of it. Thanks

also though dont worry i realised it's O(n^2) since k can be arbitrarily large

What's the difference between ∀a. (a -> a) -> (a -> a) and (∀a. a -> a) -> (∀a. a -> a)?

Disregarding the i - 1 in both (since 1 is constant):

n * ( n - k + k ) = n * n = n^2

The first encodes a natural number, the second is the identity function specialised to identity functions

>Join #dailyprog on freenode
thanks but i will pass; i am already on the discord and have completely left irc.

Whats the discord?

I want to join it.

there isn't one

leave this board too

>Join #dailyprog on freenode
But why?
Jow Forums is already good for talking. Why do people insist on splitting people up with irc and discord channels?

cope/paste this in your browser url bar (you may have to type the javascript: part manually)
javascript:atob("aHR0cHM6Ly9kaXNjb3JkLmdnLzRUdWhQaHI=")

Jow Forums is down every now and then

Jow Forums is dying

So docstrings are cool but they take up a lot of space and make the code hard to navigate, is there a way to solve that?

not clicking that shit, nigger

Equivalent as far as I can prove.

Attached: sorry.png (980x316, 13K)

seems legit

it's legit, believe it or not

comes out to discord.gg/4TuhPhr

Yesterday was the only time in my 10 years on Jow Forums that I was annoyed by its downtime.

And if Jow Forums is dead, then a /dpt/ channel on IRC will also die, since there will be no new users.

delete this, posting raw discord links is categorized as advertising and now banned on sight (discord is now too much a menace to Jow Forums)

Thanks. Im in. That code snippet is crazy

>using interactive theorem proving to prove how big of a brainlet you are
forall a. (a -> a) -> (a -> a)
admits the church encoded natural numbers:
0 = \f x. x
1 = \f x. f x
2 = \f x. f (f x)
...
n = \f x. f^n(x)

on the other hand
(forall a. a -> a) -> (forall a. a -> a)
(forall a. a -> a) is the type of the identity function. there is one identity function (\x.x). there are two obvious ways of defining this function
\f. f
\f.\x.x
these are actually equivalent because it's a unit type, so f would reduce to \x.x anyway

That fucking post was so fucking infuriating, and I don't even like C++.

Just do this sort of thing with questionable content.

Attached: Capture.png (588x120, 11K)

>But why?
IRC is more comfortable in some ways for discussing some more specific topic, talking is more smooth and you know when someone is samefagging

>Why do people insist on splitting people up with irc and discord channels?
noone is insisting on using discord for anything, quite the opposite

Are you infuriated? It was my doing.

Attached: Le+troll+face+xddddd+they+_facc7964177c1cc18f6c619de5bc5feb.png (800x600, 7K)

You never responded to my retort so go fuck yourself. Find it in the archive if you want.

Which asm should I learn (I want to code for W*ndows)?
Where to start, e.g. some online resource or book?

What retort exactly? Installing visual studio?

Attached: 1id341.jpg.png (701x566, 36K)

Thanks for elaborating, I think I get it now.

So does this mean that without higher rank types that polymorphic functions are not first class?

jvm assembly.

wasm is the answer.

>What retort exactly? Installing visual studio?
No, nothing of the sort, Visual Studio is garbage.
I explained why your entire post was complete bullshit and why most of the issues you were having had nothing to do with C++ being garbage and everything to do with you being a moron.

>I explained why your entire post was complete bullshit
Come now, you don't really believe just saying that means you are right, right?

Attached: 8e5.jpg (684x721, 52K)

i don't know what this has to do with what we were talking about but sure, passing polymorphic functions as arguments -> higher rank
notice that you can re-scope one forall here
(forall a. a -> a) -> (forall a. a -> a)
forall a. (forall a. [a -> a]) -> (a -> a)
it's still rank-2 because there's a forall left of an arrow that can't be moved up, while the church encoding (forall a. [(a -> a) -> (a -> a)]) is rank-1

>Come now, you don't really believe just saying that means you are right, right?
It does actually, I know I'm right because of how I am. That means you're wrong.

>I know I'm right because of how I am
Well that's exactly where you are wrong. People call this "delusion".

>Well that's exactly where you are wrong. People call this "delusion".
It's actually called "enlightenment" when I do it. It's only "delusion" for plebs like you.

I was , I was trying to figure out what the difference was between the two types.

>It's actually called "enlightenment" when I do it
Yet again, that's exactly where you are wrong. People call this "delusion".

Attached: index.png (300x168, 5K)

>Yet again, that's exactly where you are wrong. People call this "delusion".
Also, in case you're still not convinced. I fucked your mother so I can't be wrong.

Well I explained here and here Most things with bound identifiers are equivalent up to renaming, so you can think of one of them as
forall a. [(a -> a) -> (a -> a)]
and the other as
(forall a. [a -> a]) -> (forall b. [b -> b])

>in case you're still not convinced.
Well I'm convinced that you are deluded. At least that's where we agree.

Attached: 46c.png (600x509, 122K)

It's settled then. I fucked your mother too hard and it has caused you to be born with brain damage. I apologise for affecting your life in such a negative way.

quality /b/ level discussion right there

Sorry to hear your children are brain damaged. Probably runs in your family.

Attached: qzxIm4V.png (403x394, 17K)

daily pajeet thread, what did you expect from these retards

Attached: dpt.jpg (800x1000, 164K)

This is higher quality posting than usual. You should be happy. If it wasn't for us then you'd have to listen to some retard who started programming yesterday tell you how they think their 4 years of CS degree has made them a better programmer than literally anyone else who actually knows what they're doing.
It's only the children I had with your mother so it's clearly not my family.

This is a asymptotic notation free board, user.

Attached: mods-are-gay.png (613x410, 52K)

>This is higher quality posting than usual
well, at least they're not that javascript loving faggot

>Join #dailyprog on freenode
So now we have #dailyprog on freenode and another #dailyprog on rizon?

>It's only the children I had
Yes that's why I said I'm sorry to hear that your children are brain damaged. Probably runs in your family.

Attached: Time+machine+that+only+travels+to+the+future+and+as+_95506f27b44186809246adc719ebe54b.jpg (322x275, 21K)

I mean, it's unsurprising that you're having some trouble reading what I wrote when you must have an IQ of around 75 and probably a large dent in your head along with major issues with eyesight.
N e x t t i m e I w i l l t y p e l i k e t h i s s o t h a t y o u h a v e a b e t t e r c h a n c e o f b e i n g a b l e t o r e a d w h a t I w r o t e.

>you must have an IQ of around 75
That's at least 3 times as high as yours.

Attached: 7LBqBSO.png (293x260, 10K)

What am I doing wrong, fellas?

Attached: file.png (3946x1674, 2.23M)

using an imac

it's hackintosh

there's your problem

__init__.py is wrong.

why?

It's amazing that for someone with such a low IQ that you are capable of producing such a retort. But I was not trying to insult you, I was merely stating the facts, it's unfortunate that society is unable to cater for people with an IQ as low as yours.
Don't worry though, you mistook my age for my IQ, my IQ is actually around twice yours.

Show content of it.

it's empty

why are you arguing with someone posting that shit? No matter how well thought out your post is, they're just gonna respond with more shitposting. Just like the mongs who post the r9k brainlet pictures with a >greentext

You need to do import mod in it.

?

Attached: file.png (1478x1068, 260K)

>It's amazing that for someone with such a low IQ that you are capable of producing such a retort.
That's obviously because my IQ, as I said before, is 3 times as that of yours. But don't be amazed, because it was not amazing to people with high IQ.

Attached: 258.jpg (422x345, 16K)

Attached: images.jpg (257x196, 8K)

Did it work or not?

How do you know those pictures are from Jow Forums?

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

don't forget to statically link your programs!

Golet, pls

nope

Attached: file.png (2286x1518, 549K)

There is no reason to ever dynamically link
>oh no muh binary is a little bit bigger
who cares

>statically link in glibc and all third-party libraries
>executable is now 113 MB
Thank you for coming, we'll call you back. Don't call us.

Nice extreme and unrealistic example.
but
>using C shit

>113 MB
oh no, my 0.01% storage!

>linking with boost or qt
>extreme and unrealistic

>boost or qt
the absolute state of clets

>Library updates
>Literally need to recompile everything that depends on it
>Need to recompile everything that depends on those too
>Literally takes years of compute time to upgrade your system
No fucking thanks.
Static linking is a fucking mistake that proprietary cucks try to make seem like a good thing to push their shitty agenda.

>you should use Go because of all the bloated features it has compared to C/C++
>lol why are you using boost or qt, they're bloated as fuck!!!

>everyone who like static linking is a go brainlet
wew lad

See

>Dynamically link instead
>.sos alone are at least 200MB

Enjoy your API breakage lol

Static linking in 2018 is absolutely retarded and everyone knows this, except Unix dinosaurs like Ken Thompson and Rob Pike.

only if you're on shitlangs.

The solution is obvious - keep all your compiled objects around and dont link them until load time.

>can't into versioning
Go-let detected

What happens when the users don't have the version you require, idiot?

Please, statically link your CLR/C# runtime or whatever and enjoy your 2 GB binaries all with slightly different versions of the runtime.

>keep all your compiled objects around and dont link them until load time.
So.... dynamic linking?