Old thread: What are you working on, Jow Forums?
/dpt/ - Daily Programming Thread
I want to FUCK Nagatoro
Second for sepples.
I want to FUCK Nagatoro non-sexually.
nth for spending too long on basic problems
that's not even her you normans
first for I enjoy writing code in python and theres nothing you can do to convince me to use another language
gottem :o)
Say I have an if statement with several "and"s like this:
if aa == 11 and bb == 12 and cc == 13:
print('Great')
But imagine if one of the ands evaluates to false, I want to know specifically which one. What's the best way to figure that out without a bunch of extra code? I've been doing this but am open to suggestions.
if ((locals().update({'s':'aa'}) == None and aa == 11)
and (locals().update({'s':'bb'}) == None and bb == 12)
and (locals().update({'s':'cc'}) == None and cc == 13)):
print('Great')
else:
print(s)
The idea is whichever one short circuits will first write something to the variable s telling me which one it was. It gets the job done without a lot of fuss but could be better.
>curlies for a pattern match block
rust is the most disgusting lang to ever be created
That's too hacky. Just write the ladder of if-elses. Future you will thank you for this.
Braces are required only if you have multiline blocks
if aa != 11:
foo()
else if bb != 12:
foo()
else if cc != 13:
foo()
else
bar()
If the bodies of those clauses are too long for you, factor them out into a (local?) function.
wrong
Oh nooooo
Why are there braces in a braced language nooo such disgust
>That's too hacky. Just write the ladder of if-elses. Future you will thank you for this.
I feel what you're saying but usually the reason I resort to this in the first place is the real code I'm working with (somebody else's) is already so convoluted with huge blocks under the if statement, putting a whole nother layer on top is not happening. I was hoping somebody had something else but I understand why not. The way I'm doing it, under the circumstances, I think, is the "something else" haha
rust is unironically ugliest language I ever saw. Uglier than perl and sepples, which is quite an accomplishment in my book.
C++ twisted your view on what should be considered as a pragmatic syntax.
I see you have no argument left.I don't care about your opinion.
C++ is disgusting too.
whitespace FPLangs are the future.
Shit, I already replied but, same deal. The real code is so tangled up adding so many more nested ifs would make me jump off the building
extract those if-elses into another function then. Well, you actually should refactor that entire function with huge if-elses.
Cry hqrder
maybe if they weren't so inefficient
>FPLangs are the future.
they're the past
linear types soon™.
linear types won't do anything to help the real reason they're slow, the indirection everywhere
this Perl is ugly as fuck too. But rust... Rust is something else entirely.
It is not just my opinion. It is objective truth.
Whitespace esotericlang is the future
en.wikipedia.org
So in the past that nearly every new lang has functional tools, the web is going FP, more and more places are adopting haskell, plebs are re-discovering the power of purity and immutability.
working through barney's c++ book for an interview rn, after that probably going to either learn c to fux with some microcontrollers or finish learning scala cause it's comfy as fuck
Yes they are, but lot of mathematical progress is required before they manage to match the performance of low-level imperative languages.
>the web is going FP, more and more places are adopting haskell
surely a programmer who is able to grasp logic can see the problem with these two statements
Why bother when imperative languages are there already
complex solution to a simple problem
This is the answer. I wasn't seeing it for some reason. Factor whatever I'm testing into a function, test the function and let the function itself report if it fails or not
Yes, haskell is the sepples of FP, but baby steps.
*blows up your runtime*
*wastes your time*
*bloats your LoC*
*forces you into POO*
heh, nothin personnel, programmer.
The power of purity and immutability? You mean the inefficiency, right?
install gentoo
>haven't been able to work on open source for the past month because my job has been all over the place
>some guy just deleted his pull request and removed his branch
guys please don't do this, open source guys have jobs, don't be drama queens because daddy doesn't give you attention
haskell is the brainfuck of FP
*fails to make a single valid argument*
Last thread:
> cnile boomer cringefest
This thread:
> Fpzoomer cringefest
>runtime safety isn't a valid issue
>the sheer amount of time wasted de-bugging imperashit programs isn't a valid issue
>the LoC it takes in non-fp langs isn't a valid issue
>POO isn't a valid issue
oh hey, i'm talking to a cnile, i guess all these things are features of imperashit languages huh?
FP is actually some greatest generation shit
Curly braces are aesthetic and elegant.
Off yourself.
they're literally the antithesis of a e s.
Are you using the time you saved in loc to shill fp here?
No, that's significant whitespace.
i have plenty of time user, i'm compiling afterall.
guys, stop discussing meaningless shit and let people actually working on things post their stuff
runtime safety is the only point that approaches validity, but FP is not required for that
all big programs require debugging. All high-level languages can have a low LoC count. OOP isn't an issue, the issue people have with OOP is cargo cult programming
>tfw based javascripter
Top kek
>literally less noise to read is uglier
you have actual brain damage
I dub this thread: men with hammers the movie the musical
>noise
visual delimiters*
Don't forget to dilate
>all big programs require debugging
only for logic bugs.
I have no idea why people think run-time safety for non-logic is some mysterious black box that can never be solved.
>OOP isn't an issue, the issue people have with OOP is cargo cult programming
Right, just abide by all those arbitrary rules to make OOP good™
[insert the picture of the JS book, and the JS: The good parts book next to it]
POO cultists are insane.
fuck off cringy retard
he probably thought you didn't like his pull so got embarrassed and deleted it, was he a newbie?
>only for logic bugs.
are you implying thats insignificant?
most bugs that arent logic bugs are trivial to solve
"runtime safety" is can be achieved by just ignoring errors instead of crashing, what qualifies as runtime safety is very subjective
Why are FP Trannies so angry about OOP?
mad cause bad
>[insert the picture of the JS book, and the JS: The good parts book next to it]
cnile boomer couldn't even bother to attach his non-argumentative bait pic
Damn you're right. My repository is the only one he's starred or commited a PR to.
cuz they are Out Of Penis
No, i'm saying that you can have a program that's completely run-time safe barring a compiler bug, so that logic bugs can't crash it.
>"runtime safety" is can be achieved by just ignoring errors instead of crashing, what qualifies as runtime safety is very subjective
dumbest fucking thing you've said so far, but what you can expect from POO worshipers.
please learn what "cnile" actually means.
because OOP is pretty shit.
Or, more accurately, the object oriented paradigm makes it very easy to not only write terrible and buggy code, but also hide the fact that you wrote terrible and buggy code.
Not to mention that best practices vary significantly between OOP languages.
Which means you can get programmers going from one to the other thinking they're doing what they should when they're really really not.
FP fags may have their heads firmly wedged deep inside their rectal cavities, and pure functional programming may, for the most part, be unrealistic academic nonsense, but they do have legitimate criticisms.
they don't understand that a paradigm can be used in tandem with other, even opposing paradigms in order to achieve goals in a faster, and more maintainable fashion. and must justify their intellectual investment into the paradigm they chose to pursue, because clearly only one is allowed, and theirs is the best, that's about it.
i come to these threads to laugh at them, which talks volumes about me as a person as well, but hey, at least i'm not a FP purist
Why are you still not programming in C++20, user?
just answer with "thanks, but I'm very busy at the moment and can't do the review. please wait".
>don't be drama queen
the irony.
and the dumbest thing you and every FP have said is that runtime errors are bad and we need to make whole new languages to avoid them
runtime errors are invoked by the fucking program to aid the programmer in fixing what is most likely a bug
they could just as easily be silently ignored and you'd have no fucking runtime errors aswell
or you could jcheck every memory/array/resource access first to make sure it never goes out of bounds and you'd have "runtime safety"
The whole idea makes no sense, nothing will ever save you from logic bugs, the idea of a fully safe program is a myth
>lmao you like using stable programs?
>lmao why aren't you writing your programs to fail?
>lmao you actually like saving time?
it's like i'm in a twilight zone episode.
>the best way to practise is to do code your own programs. Just start a project bro
Ok, but what should I build? Really no idea. I'm working with C#/Visual Studio, I know the language by now but have no idea what to do with it. I did some small Windows Forms shit like a unit converter, feet to meter and oz to kg, a little program where you can manage a list of customers, add them to the database, update their entries etc but I can't say I'm really getting good or that I would have learned that much
Can you give me some ideas of what to build? My goal is to score a junior .net/c# position rather sooner than later, with what could I impress potential employees and what makes me actually better?
some programs should be written to fail. some shouldn't. Either way, it has nothing to do with functional programming. Complaining about runtime errors is like complaining about your body feeling pain. They are messages that are there to help you
I'm making a room generation function for my dungeon game, in 3D. So far, my approach is to build a room with 4 walls, a floor and a ceiling, then remove the wall where the door (or windows etc) should be, re-scaling the original mesh to just before the door and placing another mesh just after. Except removing walls is much tougher than it sounds. I have to check each case for (so far as I counted) 13 cases:
>door at the beginning of the wall
>door at the end
>door in the middle
>door from beginning to end
>door that reaches the ceiling at each of those cases
>door that doesn't touch the ground at each case
>full door (remove entire wall)
I'm being broad at what I define as door here, it's more like a hole in the mesh so I can later place anything I want. Pic related, I don't even think I've included every case there. Is this the only solution? I could make it simpler by just defining the points at which a door can appear and the size etc, but eventually I'll have to also code a function to make stairs on the floor, and the same problem would occur again. Any advices?
>Complaining about runtime errors is like complaining about your body feeling pain.
awful analogy, pain isn't a runtime error, it's an intended mechanism.
You mongs can't do anything right
I don't have time machine.
Runtime errors are an intended mechanism. Runtime errors are a feature, they are included in a programming language specifically to notify you upon a failure. How stupid are you? You don't even know how programming languages work
a video game
GCC 9 has experimental support for a lot of C++20 features.
gcc.gnu.org
You have no excuse.
You're conflating run-time errors with exceptions.
Ironic you're accusing me of being ignorant.
exceptions can be used to report runtime errors, yes, but i'm not equating the two
Jow Forums clone
worked for me :^)
You could do something like
def all(*xs):
try:
return xs.index(False)
except ValueError:
return -1
then
i = all(aa == 11, bb == 12, cc == 13)
if i == -1:
print('Great')
else:
print(['aa', 'bb', 'cc'][i])
why not just modularize the components? like have a door component, and a wall component and assemble the perimeter out of those. think like voxels in minecraft, but with walls. have a wall and a door mesh that are lets say 1/3 of each walls max length. then just put doors where you want doors and walls where you want walls.
i suggest you just use a grid
Oh this doesn't short-circuit though. Nevermind.
for a C# position the only thing that comes to mind is a full stack web developer. not extremely appealing but hey its good money. try rolling out a quick personal website in C# it'll scaffold it for you in Visual Studio. you can put it on your resume as experience and put your projects on it to act as a secondary resume. even if you don't do web dev it will be good experience because you're putting together a project with many parts and a custom configuration which is basically what every dev position is about.
cross platform mobile sucks
>inb4 qml
not one single book on this
>mobile development
fuck off
>book
fuck off
Shouldn't have expected anything more from a weeb NEET
You mean using grids with standard component sizes?
Yeah, I think I'll end up doing that. I don't know how much of an impact it will have on performance, though.The way I'm doing right now I can have a whole room with 6 squares, if there was a wall and a stair on the ground, it would be 16 squares, size independent. With grids it would scale with the square of the size of the room.
Books are inefficient. Reading the documentation would've been a much more effective use of your time.
ye
a computer can handle a few squares
procgen doesnt need to be that fast, its only run once
Want to start programming. Already bought the socks. Where should I start? Any guide or book? ( want to make 2d games in unity)