/dpt/ - Daglig programmeringstråd

Hva jobber dere med, Sup Forums?

Gammelt tråd:

Other urls found in this thread:

youtube.com/watch?v=endKC3fDxqs
youtube.com/watch?v=kiWy2BJdYgQ
youtube.com/watch?v=avtZJKydB-E
catb.org/esr/structure-packing/
doc.rust-lang.org/nomicon/repr-rust.html
dave.cheney.net/2015/10/09/padding-is-hard
twitter.com/NSFWRedditVideo

Dummkopf

¿Qué?

go golang

Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/~!

MURIKA!

die anime

N O T P O P U L A R

die

Haskell!

Okay, I am a bit concerned about variable shadowing. Is it safe to have the same argument name between two chained functions?
Tldr = should belongs_to have "items" in its argument?
void print_basename(string[] items)
//items in the argument, so anything within the scope knows what "items" is
{
bool is_null_terminated = belongs_to("-z", items);
writeln(is_null_terminated);
}

bool belongs_to(T)(T target, T[] items)
//items called again. Remember, this function is called from print_basename()
//it should aready know "items", since it was passed from the previous function
{
foreach (item; items)
{
if (item == target)
{
return true;
}
}
return false;
}

Shouldn't be an issue in really any language

still here with my 1000+ line batch script

It's fine.

It's safe, even Rust approves it.

You must enjoy wasting your time.

>twitch
>wangbloz

Thanks

No, but I enjoy triggering people on Sup Forums.

>twitch
Where?

this is totally fine user
variables are just conveniences for us to better read code, underneath they are basically just pointers to locations in memory, they only matter to the compiler (or interpreter) in terms of scope - where a variable must be uniquely named in the scope it is defined in

each function you have written has it's own scope

make sense?

Er å programmere i objektorientert språk det mest patriotiske en nordmann kan gjore?

Yes, thank you.

Enkelt å greit, nei.

How does it feel knowing that the quality of posts on /dpt/ is higher today because of the Windows ransomware pandemic keeping its worst posters away?

comfy

Hvorfor?

Objektorientering er direkte unorsk

I got the best programmer in my team fired today.

Et sporsmål kun en guling eller svarting ville spurt.

Most of the Europeans I worked with have terrible accent in English. Why is it that Sup Forums only makes fun of pajeets?

hahaha så morsom xDDDD LOL

point in case

Most European accents are understandable, and lots of Europeans speak pretty good English, not a bastardized abomination containing such gems as "please do the needful". And be honest, it sounds kinda cool working with an Eastern European or Russian, like you're doing serious fucking business.

Except the French. Fuck the French, worst accent ever.

point in case Enkelt og* greit

>Most European accents are understandable
Oh how wrong you are

I've worked with Swedes, Germans, Romanians, Finns, Portuguese, Austrians, Russians, Latvians, Slovenians, Scots, Irish, and French. Never had a problem understanding any of them.

>Oh how wrong you are
Did the person with the "European" accent you have spoken to happen to be not white?

Probably because you are one of them

I'm English.

youtube.com/watch?v=endKC3fDxqs
qt spotted

youtube.com/watch?v=kiWy2BJdYgQ

Is it easy to understand him?

Yes. The audio quality isn't great, but he's perfectly understandable.

>Is it easy to understand him?
Yes, he has an obvious accent, but anyone who are fluent in English really shouldn't have a problem understanding him.

Yes.

in dynamically scoped languages it is.

Definitely isn't an issue in C.

Probably it varies --it's kinda hard for me as an Ausfag

It's kinda hard for me to understand Ausfags sometimes, so it's obviously not because of him being E*ropean.

tbqh he's a lot more comprehensible than most Aussies

It's one thing to have a difficult to understand accent.
It's another to also have poor grammar.

I've got a $5 coupon on amazon, so I'm thinking about buying a c++ book, but there are so many

If it's not written by Bjarne, don't bother, just use google. Most language specific programming books are just the language documents in print.

Correct.

Typical memesnek conference: youtube.com/watch?v=avtZJKydB-E

yes

I'm trying to make this function not generate a star if there's another star within a 10 unit radius around it, but it doesn't work. I don't logically see why this won't work, so a fresh set of eyes that can point out the stupidity of what I've written and glossed over is greatly appreciated.

def build_universe():
alreadyOccupied = []
count = 0
while count < STARCOUNT:
randx = random.randint(5, UIX)
randy = random.randint(5, GAMEH)
if (range(randx - 10, randx + 10), range(randy - 10, randy + 10)) not in alreadyOccupied:
Star.stars.append(Star("Star", randx, randy))
alreadyOccupied.append((randx, randy))
count += 1

Came across this website here

catb.org/esr/structure-packing/

a good read if you're into C, it's not something I've read about anywhere else

What language do the Fins use the most?

How does PEG compare to CFG?

Someone give me the straight answer for "What is software evolution?"

Theres no solid fucking definition and it blurs with software maintenance

Let's play some code golf, /dpt/. Implement the following function in a statically-typed language of your choice:

f : (b -> a -> b') -> (c -> a -> c') -> (b, c) -> a -> (b', c')

Because range produces a list in python 2, and you are creating a tuple of 2 lists. Since you are using not in, the program will look for exact match of a tuple with the two lists and not necessarily each combination of tuples like I think you are assuming.

C# ja js.
Fucking microcucks and nu-males.

Yeah, I just made that realisation myself, I think I'm gonna have to take a very different approach to achieve what I'm going for.

To make things simpler I suggest you include alreadyOccupied points with points in 10 units range of a star to make the code simpler. It should be something like this:
def build_universe():
alreadyOccupied = []
count = 0
for _ in range(STARCOUNT):
randx = random.randint(5, UIX)
randy = random.randint(5, GAMEH)
if (randx, randy) not in alreadyOccupied:
for i in range(randx - 10, randx + 10):
for j in range(randy - 10, randy + 10):
alreadyOccupied.append((i, j))
Star.stars.append(Star("Star", randx, randy))

I'm disappointed, /dpt/. I thought at least one of you would do it.

Okay holy shit that's exactly what I was going for, thank you so much. I've worked a lot with 2d arrays and things like this before so I dunno how that solution didn't come to me. Again, thank you very much.

There is a mistake, it should be range(randx - 10, randx + 11) because the range upper bound in non-inclusive. Same with randy

This is a useful read, and similar things can be applied to most other compiled languages

Rust:
doc.rust-lang.org/nomicon/repr-rust.html
Go:
dave.cheney.net/2015/10/09/padding-is-hard

What's the most ethical field of software development? I don't want to contribute to the wealth of 1% with my code.

Free software development?

i dont even know what that means

>GoPro falls into pit of rattlesnakes
programming will never be the same

Producing software which executes leftists.

Probably reverse engineering government stuff if you want to contribute anything.
otherwise fsf.

Open-source medical software engineering. You will be a pioneer, since at its current state the industry is overrun with proprietary everything, with security vulnerabilities in medical equipment peoples' lives depend on.

This

are tuples/pairs bad? should I use std::tie or std::get?

why am I not just using structs?

This. While open source retards continue to write another text editor from scratch, healthcare industry is completely fucked

everything you said is true but your hands will be tied and you'll hate yourself.

I've done it.

What is "b"?
What is "a"?
What is "c"?
What is "b prime"?
What is "c prime"?
How and when did you introduce these variables? Please don't post implicit garbage in this thread. Thank you.

>your hands will be tied
what do you mean?

Tuples are useful when you need multireturn functions

I was literally told by my manager as a sysadmin at a medical research facility (including clinical stuff) that "security is not a priority" and no care for an ever increasing amount of technical debt while their played government style politics with upper management.

I'm using them in vectors, that's fine?

Well thats why you dont work for other people.

Parameters a b c b' c' : Type.

Lemma f : (b -> a -> b') -> (c -> a -> c') -> b * c -> a -> b' * c'.
Proof.
firstorder.
Qed.


Output:

f =
fun (H : b -> a -> b') (H0 : c -> a -> c') (H1 : b * c) (H2 : a) =>
prod_rec (fun _ : b * c => (b' * c')%type)
(fun (a0 : b) (b0 : c) =>
((fun H3 : a -> c' =>
(fun _ : c' => (fun H5 : a -> b' => (fun H6 : b' => H6) (H5 H2)) (H a0)) (H3 H2))
(H0 b0), (fun H3 : a -> c' => (fun H4 : c' => H4) (H3 H2)) (H0 b0))) H1
: (b -> a -> b') -> (c -> a -> c') -> b * c -> a -> b' * c'

...

Depends on your use case

wtf does this shit mean

That is a function signature, not a function. What is the function supposed to do? And are these parameters supposed to all be generic? What is their purpose within the function?

tuples are good but C++ is bad

>he's never used a functional statically-typed language

@60359939
>What is the function supposed to do?
It is supposed to prove the lemma in this post What makes you think so?

rate!

It's shit

its literally just overly-complicated functional wank for the purpose of looking imposing.

...

>It is supposed to prove the lemma in this post
I'm not sure how a function signature is supposed to prove a lemma, but next time you ask for people to implement a function, it should be helpful to enumerate what the parameters are, and what the function does. The floor function and the cosine function both have the same function signature (real number to real number), but do completely different things. Knowing what a function's signature is tells us nothing about its intended usage.

>I'm not sure how a function signature is supposed to prove a lemma
Fuck you and your ignorance
I hate you

>What is the function supposed to do?
There is only one thing it can do.

>And are these parameters supposed to all be generic?
Yes.