/dpt/ - Daily Programming Thread

Previous: What are you working on, anonymous?

Other urls found in this thread:

youtube.com/watch?v=bl8jQ2wRh6k
deepmind.com/blog/deepmind-and-blizzard-release-starcraft-ii-ai-research-environment/
en.wikipedia.org/wiki/Corrupted_Blood_incident
courses.csail.mit.edu/6.851/spring14/
reddit.com/r/dailyprogrammer/comments/5aemnn/20161031_challenge_290_easy_kaprekar_numbers/
docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html
twitter.com/SFWRedditImages

Haskell is currently the best language

Ordinals are numbers, therefore infinity is a number.

Checkmate, mathematicians.

>definitions
how interesting!

I want to do application development but don't want to use c++.
With java the user would have to have jvm.
For application development would d lang be the goto?

Is it better to have an O(n! * n^2) algorithm, or a Θ(n!) algorithm?

Making a 3D space-shooter with some friends in our own shitty engine

Added a wireframe mode, looks dope as fuck

Also OOP-C++ representing

And the addition is non-commutative. I don't like such numbers.

>Not a new IP
I though Haskell was the best language?

What the fuck does that weird O with the line in it mean?

>OOP
smug anime face.png

m8...

C

When I make my language that has affine types with borrowing, higher-kinded types, higher-rank polymorphism, and SMT-proven dependent types, it will be better.

Ειναι Ελληνες, ανον

This is the capital theta for the tight bound, when you have two non-zero constants k1, k2 that k1|f(n)|

>capital theta for the tight bound,
thanks for being actually helpful not like these other edgy asshats.

when I make more money than these fags i'll remember times like this and laugh.

>when I make more money than these fags

It's funny cause that's not gonna happen if you can't even git gud

everyone starts somewhere.
not a CS major.

especially the weeb reply fags

Of course I will be using OOP if I'm making an engine. What, want me to use a completely new engine for every game only optimized for one game?

Besides, without classes, sharing a .git with 6 other people is a nightmare when it comes to conflicts.

>OOP is the only way to reuse code
Sad!

why don't you use >>>>Modern C++ instead

Sorry, you don't have the chance to be as smart as me.

I pity you. :^)

Link your fucking repo

Too bad we won't be able to tell in a few years.
whatever. back to learning more.

>Besides, without classes, sharing a .git with 6 other people is a nightmare when it comes to conflicts.
Right, even though sharing a Linux kernel with 10,000+ people somehow works fine.

if( op.image.isAnime() == true )
{
reply("just fuck you guys brah\n");
}

>mfw links work in code blocks

>current year
>not using some Lisp diallect
youtube.com/watch?v=bl8jQ2wRh6k

shiggy diggy

>everything is lists!!!
lisp is shit

> == true
Best be jesting

>everything is memory!!!
c is shit

But user... Linux is actually a mess...

Looks like you haven't looked at the leaked WINDOWS NT source code.

>Implying I said Windows was actually better
BSD is the only kernel done right

You have managed to make the most POOINLOO if statements since you started sperging out. If you spent half as much of the time studying instead of sperging, you would be too busy earning lots of money to post about how anime images are ruining your life.

It's not, but fuck me, it's easier.

>everything is a clusterfuck of flavor-of-the-month features!! everything is badly designed!!
python, java, and go are all shit.

͏ ͏TOPPEST

͏ ͏͏ ͏ ͏- of -͏ ͏

͏ ͏ ͏ ͏ ͏KEK

You are fucking yourself but if you enjoy it then go ahead.

not arguing for any of those languages :^)

>everything is proof!!!
coq, agda, twelf, lean, isabelle, nuprl
all shit

I can't answer to your post since you don't provide any meaningful arguments. Please explain user-kun

what are vectors, hash-tables, trees, whatever the fuck you want it's there for you

I think that the burden of proof is on your side, user.
You're claiming that BSD > Linux, I'm just showcasing my mad triforcing skillz.

> . (==) ! :: (Functor f) => Monad (Free [f a -> Text -> String])
> (map . (== 3)) liftM_ $ f return :: (Monoid a) => IO (Either (Maybe IO a) a)
wow so pure !!!

Still more readable than objective c

What a waste of sperging time... We already found an agreement...

Despite everything, let me shitpost:
BSD networking kqueue is much more powerful and faster than Linux epoll. Just this is a enough to be a reason to use BSD on every servers where performance matters.
BSD isn't widespread due to the lack of support/popularity and the bad drawn mascot.

>inb4 literally what
I'm an anime girl

>BSD networking kqueue is much more powerful and faster than Linux epoll. Just this is a enough to be a reason to use BSD on every servers where performance matters.
Linux *poll is worthless crap, but everyone is using kernel bypass magic where it matters anyways.

>BSD isn't widespread due to the lack of support/popularity and the bad drawn mascot.
No drivers.

>I'm an anime girl
You wish you were.

How does one know if they enjoy fucking themselves?

Go fuck yourself and find out?

>not at anime girl
Lies.

Kys faggut

>kernel bypass magic
True.

Username checks out.

𛲠

Can I help ?

Post screencap faggit

Ib4 shit unity game that barely works

kek, yeah

>pre-alpha

const vector& getObjects()
{ return Objects; }


Is this the proper way to pass a vector of pointers?

No, you're returning a reference to that vector here, not the vector.

deepmind.com/blog/deepmind-and-blizzard-release-starcraft-ii-ai-research-environment/

>mfw computers will be the only ones playing sc2

are korean computers better than american computers at sc2?

When are they going to collab with researchers in WoW?

They tried to get epidemic data from:
en.wikipedia.org/wiki/Corrupted_Blood_incident

But Blizz said no.

Going through the K&R C programming book.

There's this example
while((to[i] = from[i]) != '\0')
++i;
Which copies a string from one array to another.
If the string copied is "hello\n\0" why does it copy the \0 at the end instead of the while loop stopping when it sees that the condition != '\0' is false?

If it didn't copy the 0, then the copied string ... wouldn't have a 0, and so you wouldn't know where it ends.

It does the copy then checks. This is so the copied string is null terminated.

In C++, does calling clear() on a vector delete the items in it?

Same as the values going out of scope. If they have destructors, they will be called. If they're pointers, delete will not be called.

If they're pointers, it won't call delete on the pointers.
If they're regular values, it will call their destructor.

because inside of the brackets resolves first
(to[i] = from[i])
assigns the characters to new field
then
((to[i] = from[i]) != '\0')
evaluates false and the loop ends (but the character is already copied)

Generally speaking, making assignment as part of a condition is bad practice. Your goal should not be keeping the code as short as possible but easily readable.

On the other hand, you generally want to keep the '\0' as a last character of the string (array of chars, C has no string) because if you called the function again on what was previously your "to", it would keep reading random chunks of memory until you run into a random byte that just happens to be 0.

Thanks.

Θ(n!) is better.

But with O(n! * n^2), it might actually be O(n), you just don't know if it is!

trick question the first algorithm is secretly Θ(n)

When doing the depth first search on a binary tree using the stack method, do I need to check visited nodes?

Or is that just to cut the search time and the answer will be the same either way.

Thanks lads. Found the part of the book where it explains this as well: "In C, any assignment such as c = getchar() has a value which is the value of the left hand side after the assignment."
So the check is done after the copying has already been done, if I got this right.

it seems to me that you run the risk of going in circles if you don't keep track of where you've been

right, if there's a logical comparison then the sides have to be evaluated first

why is this so much fun to shitpost on Sup Forums? :3

You just need to visit the current node, push the right node, and go to the left node, no need to check anything.

oh, sorry, i didn't notice the "tree" part. hm

>tfw the AI you developed is a better programmer than you are

Well this is embarrassing.

>making assignment as part of a condition is bad practice
In the general case, I agree, but using it in while loop conditions to read until EOF or something similar is a very clean way of doing it.
Other methods usually have to have special cases for the first time entering the loop.

You are no longer necessary.
Delete your Sup Forums pass.
Direct your AI here.

So this is wrong? Seems to work but i'm just trying one binary-tree sample.
Would be awesome if someone told me where this is flawed or if it's going to work 100% of the time for BTs.

public void dfs(Node head)
{
Stack stacker = new Stack();
Node currentnode;
stacker.add(head);
while(!stacker.empty())
{
currentnode = stacker.pop();
System.out.print(currentnode.data + " ");

if(currentnode.left !=null)stacker.add(currentnode.left);
if(currentnode.right!=null)stacker.add(currentnode.right);
}
}

ObjectCreator oc;
Object* object;
object = oc->createObject() // creates a new Object pointer and returns it


Is this okay?

courses.csail.mit.edu/6.851/spring14/

(sorry for the late)

how do i return a function from a function in java?

>createObject
>not constructor
kys

Learning Python by doing /r/dailyprogrammer because I'm too stupid for project Euler:
reddit.com/r/dailyprogrammer/comments/5aemnn/20161031_challenge_290_easy_kaprekar_numbers/
#!/usr/bin/env python3

def is_kaprekar(num):
squared = str(num ** 2)
pivot = len(squared) // 2
first = squared[:pivot]
if not first:
first = '0'
last = squared[pivot:]
sum = int(first) + int(last)
return sum == num

for i in range(1, 50):
if is_kaprekar(i):
print(i)

Reddit says the result of 50 is 45, but Wikipedia says the result of 50 is 1,9,45. WTF.

I'm building an interface in Curses
How do I programmatically add text to a field?

docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html

It just creates an Object pointer? Doesn't seem very useful.

...

...

If I want to make my own library in C++, are there any ways to include flags or similar things in the compilation process so that users can use those to compile the library in a specific way?

can someone suggest me a good book about bash/shell scripting and random sites/blogs with tutorials that guide me through examples/exercises?

What, are you not allowed to use cases at all?

You can use case, but if you have two identifiers that are identical except for case, ie Object object, you're retarded.