4chan archive /g/ (index)
similar threads
2019-05-18 10:03 71008417 Anonymous /dpt/ - Daily Programming Thread (1499755455844.png 1550x1123 911kB)
Old thread: >>71002463 What are you working on, /g/?

1 min later 71008435 Anonymous (1526493596047.jpg 480x269 30kB)
I wish I weren't this lazy

1 min later 71008441 Anonymous
>>71008417 >right to left why?

2 min later 71008459 Anonymous
Is it possible for there to exist a Turing complete language where every function is a list comprehension? Is Lisp close to this?

3 min later 71008467 Anonymous
>>71008459 haskell goes a long way with its list comprehensions so uhh try that lisp uses lists a lot but not comprehensions really

4 min later 71008479 Anonymous
>>71008417 what does this even mean

5 min later 71008497 Anonymous (cat-looking-disgusted.webm 275x154 245kB)
> DevWars is a live game show where teams participate in an exhilarating battle to create the best website they can within 60 minutes. Teams are formed of 3 people, with the team's members each controlling a single language - HTML, CSS and JavaScript. > https://www.twitch.tv/devwars mein gott. normies ruin everything.

5 min later 71008498 Anonymous
Redpill me hardcore on programming.

5 min later 71008505 Anonymous
>>71008497 it's like coding in the dark all over again

6 min later 71008520 Anonymous
>>71008497 >>71008505 this is cool, though. https://watch.devwars.tv/

6 min later 71008521 Anonymous
>>71008497 that's so gay

8 min later 71008551 Anonymous
>>71008520 yeah man I enjoy watching me some dudes write basic markup

9 min later 71008558 Anonymous
>>71008497 watching acm competitions broadcasts is bretty cool though

11 min later 71008580 Anonymous
>>71008551 not the content specifically but the website itself, you can select/copy the code, watch the website being build (the square on the left). that's well done.

11 min later 71008592 Anonymous
>>71008580 is it what it takes to impress zoomers these days

12 min later 71008603 Anonymous
>>71008417 oh i have read this manga!! it's so comfy i highly recommend this gay shit

15 min later 71008646 Anonymous (HntlKcy.jpg 599x607 59kB)
>>71008497 >*enroll* >look at game rules >"5. No editing languages other than the one that you've been assigned." >you get assigned to CSS

19 min later 71008688 Anonymous (image067.jpg 1000x564 30kB)
Why the fuck can't books propose some good projects to walk along rather than shit that looks like it was made by 3-year olds? I'd have more will to read a 385-pages book on multiplayer programming if the peak of the end result wasn't shitty pic related.

20 min later 71008702 Anonymous
>>71008688 If you are going to complain about what a book is spoonfeeding you stop using the book and start learning on your own

20 min later 71008703 Anonymous
>>71008688 lol

21 min later 71008710 Anonymous
>>71008497 lel, team red's CSS guy completely fucked up. everything is unaligned.

25 min later 71008764 Anonymous
>>71008688 If you were able to do something interesting you shouldn't be reading a book about it.

26 min later 71008768 Anonymous
>>71008710 Can you imagine writing from scratch, one guy exclusively has HTML control and one guy CSS control? It's like those experiments where someone had their left and right brains disconnected. For all we know, the CSS guy could have wanted the HTML guy to do something really obvious but instead he was forced to try to style a terrible DOM and barely got it working.

26 min later 71008770 Anonymous
>>71008441 >>71008479 It's a joke about transvestites, or ``traps'' as they're known in the modern Internet argot.

26 min later 71008779 Anonymous
>>71008441 me on the left

27 min later 71008781 Anonymous
>>71008768 i don't know anything about webdeb, actually. i am just listening to the stream and reading the chat.

30 min later 71008814 Anonymous
>>71008781 That's fair. It's honestly more likely the CSS guy fucked up. Or at least, if he had the skill he could have made the website look good anyway using CSS hacks

32 min later 71008838 Anonymous
Give me ONE good reason why I shouldn't waste my time learning Rust.

32 min later 71008839 Anonymous
>>71008702 >>71008764 I just want a book to follow along to make a somewhat decent rpg. Am I asking for the fucking moon?

32 min later 71008840 Anonymous
>>71008497 >>71008580 >>71008646 >>71008710 >>71008768 >>71008781 >>71008814 Did you retards even read the OP? This isn't fucking >>>/g/wdg/ . Your kind isn't welcome here.

34 min later 71008858 Anonymous
Need a subject for a deductive database assignment. Hereditary trees aren't allowed.

35 min later 71008867 Anonymous
>>71008838 A lot of time required.

37 min later 71008886 Anonymous
>>71008840 Is it the same guy that does this every time? lmao

39 min later 71008902 Anonymous
>>71008886 Fuck off to >>>/g/wdg/, subhuman scum. You are not welcome here.

42 min later 71008926 Anonymous (1541462423718.png 755x422 96kB)
the irony

43 min later 71008931 Anonymous
>>71008926 I agree that a beautiful font would have been much nicer.

44 min later 71008942 Anonymous
>>71008886 >>71008902 it's the same nerd that throws a tantrum every time somebody posts a frog image

45 min later 71008953 Anonymous
>>71008942 you mean every sane non-redditor in this thread?

47 min later 71008965 Anonymous
>>71008953 sane people don't get mad at things on the internet

47 min later 71008968 Anonymous
>>71008886 >>71008942 >>71008902 >>71008840 >>71008497 >>71008580 >>71008646 >>71008710 >>71008768 >>71008781 >>71008814 samefag

47 min later 71008969 Anonymous
>>71008838 Ethics. They're enough a reason.

48 min later 71008973 Anonymous
>>71008838 I think you should learn Rust

49 min later 71008989 Anonymous
>>71008973 shill

54 min later 71009059 Anonymous
>>71008965 I don't get mad, I just write as if I am. It's just a kind of a theatrical performance we are all doing.

55 min later 71009067 Anonymous
>>71009059 I get mad for real.

56 min later 71009082 Anonymous
tfw the BC won't let me own a gf

57 min later 71009093 Anonymous (Stanislavski.jpg 359x544 83kB)
>>71009067 Nice job. I believed. See, everyone? That's how you do it.

59 min later 71009119 Anonymous
>>71008965 The absolutely justified ubiquitous hatred of javascr*pt that can be found anywhere real programmers gather is more than people "being mad on the internet." Javascr*pt represents the glorification of stupidity, and the death of creativity. The programmers who use it, some how, don't know how to program, instead relying on "frameworks", and imported packages, creating a complicated web of incomprehensible bloat. It also represents slapdash thinking and shoddy workmanship. The original language was made in only three days, by the former head of mozilla. You can't design a well made language in three days. And it is only fitting that such a disgusting language is primarily proliferated by equally disgusting people, iToddlers. The difficulty of actually developing for fruitfag platforms makes web based applications preferable, but even if you make a native IOS application, if you want dynamic code execution, you have to use javascr*pt because retarded apple reasons. truly there is nothing worse than javascr*pt

1 hours later 71009128 Anonymous (69794a9c7d2db52688d1883ea57ec7c1.jpg 1364x2048 260kB)
Hey, Anon. Can I come over to you so we can learn JavaScript together?

1 hours later 71009162 Anonymous
>>71009128 Typescript or fuck off. Dynamic typing is cancer.

1 hours later 71009169 Anonymous
>>71008839 >Am I asking for the fucking moon? yes learn it yourself nobody will teach you

1 hours later 71009180 Anonymous
>>71009162 Imagine using a language that has the bad performance of a dynamically typed language and the verbosity of a statically typed language

1 hours later 71009200 Anonymous
>>71009128 No, go ask >>>/g/wdg

1 hours later 71009205 Anonymous
>>71009119 Also javascr*pt contributes massively to global warming and destroying our planet. What a fucking heinous waste of resources.

1 hours later 71009219 Anonymous
>>71009180 Better than JS.

1 hours later 71009223 Anonymous
I just found out that my project for an SQL class is required to be done in R language with R markdown. I'm kind of lost since I never used R at all.

1 hours later 71009234 Anonymous
>>71009180 >bad performance of a dynamically typed language JS is THE fastest general purpose scripting language.

1 hours later 71009242 Anonymous (1535598002489.png 1240x987 409kB)
still too lazy to program today

1 hours later 71009247 Anonymous
>>71009219 Untyped JS is automatically valid TS as well.

1 hours later 71009249 Anonymous
>>71009180 >the verbosity of a statically typed language oh boy

1 hours later 71009266 Anonymous
>>71009234 luajit, lisp, scheme, and clojure have implementations that are faster than v8.

1 hours later 71009269 Anonymous
>>71009247 Not with the right tsconfig settings.

1 hours later 71009288 Anonymous
>>71009234 >THE fastest general purpose scripting language. yeah that's like saying you're the fastest snail

1 hours later 71009290 Anonymous
>>71009242 where did you get that pic of me

1 hours later 71009300 Anonymous (1520487468308.jpg 1920x1541 129kB)
Note.getDuration() returns doubles, but java wait function accepts long. How do I parse Note.getduration into wait without losing information and without out syncing my loop?

1 hours later 71009307 Anonymous
>>71009300 >without losing information you dont

1 hours later 71009333 Anonymous
>>71009307 what if get duration gets truncated to some miliseconds and the song become out sync?

1 hours later 71009335 Anonymous
>>71009300 dumb frogposter

1 hours later 71009345 Anonymous (addo.jpg 1280x720 84kB)
>make programs from problems from a textbook because I'm too retarded program anything myself >problem is to output the balance on a loan with a specific rate if the owner makes a specific payment each month >since the previous month dictates the current month's balance and I'm only doing 3 months, decide now is the time to try recursion >Everything I do results in a max recursion depth error despite the fact that the it should only do recursion 3 times at the most and I'm deincrementing each step should I just abandon this approach and do a straight iterative method?

1 hours later 71009364 Anonymous
>>71009333 You need to use some compable timing mechanisms obviously

1 hours later 71009366 Anonymous
>>71009345 yes. recursion is intellectual masturbation. real men get right down to it and iterate.

1 hours later 71009377 Anonymous
>>71009345 That's an iterative problem, not a recursive one, but if you can't even write a very basic recursive function like that one you should probably practise until you can

1 hours later 71009382 Anonymous
so much to learn and so little time outside of 4chan

1 hours later 71009388 Anonymous
I feel like half of the people that argue about language performance never actually programmed anything where it actually makes a difference.

1 hours later 71009394 Anonymous
>>71009345 just continue trying, or ask for help bug is probably trivial and you'll be embarrassed of how much time you wasted on something that simple >>71009366 TCO C O

1 hours later 71009413 Anonymous
>>71009388 Not everybody is a webdev

1 hours later 71009416 Anonymous
>>71009388 shut up, I am a real time embedded systems programmer like everyone else in this thread

1 hours later 71009430 Anonymous
>>71009416 miguel?

1 hours later 71009443 Anonymous
Give me a project to work on that will look impressive on my GitHub.

1 hours later 71009449 Anonymous
>>71009223 learning a new language's syntax is not difficult unless you're baby programmer in your first 3 semesters of ever touching a compiler, or the language has an entirely different philosophy from ones you've used before (like going from imperative lang to functional)

1 hours later 71009454 Anonymous (04F10DE1-A2B5-4AD7-BB90-8DD39600B6DB.jpg 1280x720 70kB)
Is there a compelling reason not to write haskell in a procedural style by putting most of your code in IO monads? Don’t you essentially get a better OCaml if you code like this?

1 hours later 71009456 Anonymous
>>71009443 linux kernel in haskell

1 hours later 71009458 Anonymous
>>71009454 Is there a compelling reason to write procedural haskell instead of using a real language?

1 hours later 71009462 Anonymous
>>71009345 you are probably writing infinite recursion because you do not have a proper termination condition

1 hours later 71009467 Anonymous
>>71009454 IO is NOT a monad DAMMIT HASKELL

1 hours later 71009469 Anonymous
>>71009456 I refuse to use that language

1 hours later 71009471 Anonymous
>>71009454 why would you program pure computations in IO also that's kind of what everyone does with MonadIO

1 hours later 71009478 Anonymous
>>71009300 wait(long timeoutMillis, int nanos) duration = 77.4853933276132 ms wait(duration, (duration % 1) * 1000000);

1 hours later 71009567 Anonymous
>>71009458 Its mematic

1 hours later 71009606 Anonymous
>>71009456 God damnit why is it always such complete fucking nonsense? It's always either hangman or fizzbuzz or some trivial shit, or something ridicolous like that

1 hours later 71009613 Anonymous
>>71009606 Write a forth in c

1 hours later 71009616 Anonymous
>>71009606 Make a game of Chess. Or Go. Or Checkers.

1 hours later 71009628 Anonymous
>>71009606 why is anyone going to be impressed by you making a project someone told you to make on an imageboard

1 hours later 71009632 Anonymous
>>71009616 What about a game of drones?

1 hours later 71009633 Anonymous (A1851549-A587-4331-BB0F-AD1361DA3D7C.png 543x435 130kB)
>>71009616 But with HP

1 hours later 71009644 Anonymous (1384025307544.png 256x274 123kB)
>>71009632 I'm not the boss of you. Do what you want.

1 hours later 71009662 Anonymous
>>71009606 >asks dumb questions >complains about dumb replies

1 hours later 71009663 Anonymous
What's the best way to handle variable assignments in switch/case statements in C/C++? I'm getting compiler errors because I falsely assumed that variables in different cases wouldn't be in the same scope.

1 hours later 71009674 Anonymous
>>71009606 write a web browser in verilog

1 hours later 71009680 Anonymous
>>71009663 show an example of what you're trying to achieve

1 hours later 71009683 Anonymous
>>71009663 uh, example?

1 hours later 71009690 Anonymous
>>71009674 Write Verilog interpreter in VHDL

1 hours later 71009708 Anonymous
>>71009663 Add additional scope. switch (c): case a: { blabla } break; case b: { } break;

1 hours later 71009712 Anonymous
>>71009690 Write VHDL interpreter in Verilog

1 hours later 71009729 Anonymous
>>71009708 ohh, I see what he meant now. nice catch

1 hours later 71009730 Anonymous
>>71009680 >>71009683 switch (condition) { case 0: uint8_t value = foo; break; case 1: uint8_t value = bar; break; default: uint8_t value = baz; break; } i'm getting compiler errors about redeclaration.

1 hours later 71009746 Anonymous
>>71009730 anon... uint8_t value = 0; switch (condition) { case 0: value = foo; break; case 1: value = bar; break; default: value = baz; break; }

1 hours later 71009747 Anonymous
>>71009708 fucking hell i should have thought of that. Thanks man.

1 hours later 71009748 Anonymous
>>71009730 you might as well declare value right before the switch, then

1 hours later 71009759 Anonymous
>>71009746 >>71009748 If it were just one variable, I would have just declared value before the switch, but doing that for 8 or 9 different variables seems sloppy.

1 hours later 71009770 Anonymous (1538225093106.png 813x413 270kB)
>>71009730 >>71009663 Have you considered not dong any assignments at all

1 hours later 71009773 Anonymous
>>71009759 then just use if/else, literally the same thing as switch

1 hours later 71009781 Anonymous
>>71009759 if you use that one variable independently in each switch case, it's all the same when the code executes. the compiler will probably do that simplification for you even if you don't

1 hours later 71009786 Anonymous
any progress on C+=?

1 hours later 71009795 Anonymous
anyone ever use SML at their job?

1 hours later 71009822 Anonymous
>>71009366 >>71009394 >>71009377 >>71009462 I figured it out, thank you a'll!

2 hours later 71009850 Anonymous
>>71009795 Dead lang. I’d assume anyone who actively did moved to OCaml.

2 hours later 71009868 Anonymous (1553112910111.png 894x894 591kB)
>>71009795 Employed SML programmer reporting in

2 hours later 71009878 Anonymous
>have opengl software >have telemetry that reports hardware information etc >close to 25% of users only have hardware capable of ogl 2.1 or earlier >most users on integrated graphics no shit ive been dealing with performance issues

2 hours later 71009882 Anonymous
>>71009770 >>71009781 This >>71009708 was a much better answer.

2 hours later 71009903 Anonymous
my neck, wrists, back, hips, shoulders, elbows all hurt because of programming all day, what do?

2 hours later 71009908 Anonymous
How do I make money with programming on the side?

2 hours later 71009916 Anonymous
>>71009903 drink water, eat and sleep.

2 hours later 71009923 Anonymous
>>71009882 seems heavy handed to add a block to every switch case when he doesn't actually need it

2 hours later 71009928 Anonymous
>>71009903 get better posture invest some money in a more ergonomic chair with nicer back support get a wrist rest for your keyboard

2 hours later 71009939 Anonymous
>>71009903 dont sit in the same position in your chair, move aorund alot

2 hours later 71009972 Anonymous (4cc.jpg 500x137 13kB)
>>71009242

2 hours later 71009973 Anonymous (1520359982830.jpg 298x212 8kB)
>>71009059 Nah it's just you buddy

2 hours later 71009995 Anonymous
>>71009868 What and why?

2 hours later 71010014 Anonymous
>>71008417 I'm trying to write an installer for a python script, but I get errors when I run the command created by the sym link. Here's the installation script: #!/bin/bash/env python3 echo "script installation" sudo ln -sf $PWD/script.py /usr/bin/script sudo chmod u+x /usr/bin/script echo "installation complete" And here's the output when I run the command after installing it: import: attempt to perform an operation not allowed by the security policy `PS' @ error/constitute.c/IsCoderAuthorize d/408. /usr/bin/invex: line 3: from: command not found /usr/bin/invex: line 4: url: command not found /usr/bin/invex: line 5: syntax error near unexpected token `Fore.GREEN' /usr/bin/invex: line 5: `print(Fore.GREEN + 'Script Name')'

2 hours later 71010019 Anonymous
>>71009973 dumb frogposter

2 hours later 71010028 Anonymous
>>71010014 >python shebang >bash script ok

2 hours later 71010043 Anonymous
>>71009388 I optimise (read: rewrite in a different language) really high level Python shit at work. It makes a lot of difference, if your starting point is basically unscallable.

2 hours later 71010056 Anonymous
>my http library is making it very awkward to call DELETE on a resource Considering just calling POST with the ID in the body, boys. Don't make me do it.

2 hours later 71010085 Anonymous
>>71009973 dumb frogposter

2 hours later 71010115 Anonymous
is there a way to have -0?

2 hours later 71010152 Anonymous
>>71010115 yes, floating point has -0

2 hours later 71010163 Anonymous
>>71010043 How much of that is just poor programming decisions? I am optimizing an old PHP project at work, and I've managed to get serious gains just by reworking how they were handling their database calls and by rewriting SQL.

2 hours later 71010179 Anonymous
>>71010152 yes, but -0 < 0 isn't true

2 hours later 71010196 Anonymous
>>71010179 and?

2 hours later 71010198 Anonymous
>>71010163 I've seen Python code doing something simple that was literally 100 times slower than a static language

2 hours later 71010207 Anonymous
>>71010198 Like what?

2 hours later 71010211 Anonymous
>>71010196 well that's the behavior I wanted I guess I'll have to play with a bitmask instead of signedness *sigh*

2 hours later 71010214 Anonymous
>>71010198 but at that point it's a question of time complexity rather than the language choice, isn't it?

2 hours later 71010226 Anonymous
>>71010207 Just drawing some objects on screen and updating their positions, 600 in Python was as fast as 60,000 in C++

2 hours later 71010233 Anonymous
>>71010211 if you're okay with one's complement, you get -0 that way, but it's annoying to use imo

2 hours later 71010237 Anonymous
>>71010214 no

2 hours later 71010278 Anonymous
>>71010214 The difference between languages is almost always constant factors, not asymptotic complexity.

2 hours later 71010295 Anonymous
Rate my Python repl. while True : exec(input())

2 hours later 71010300 Anonymous
>>71010163 It's Django. There is no SQL - only 20 layers of model-view-serializer abstractions. What I'm doing is moving everything that needs to be somewhat fast to Go, SQL and PL/pgSQL. I also draw pleasure from removing Python code from the project, so it might not be that necessary at times.

2 hours later 71010309 Anonymous
>>71010295 very, very good anon

2 hours later 71010317 Anonymous
>>71010237 >>71010278 exactly, i.e. >>71010198 means there was a time complexity issue because pypy isn't 100 times slower than native

2 hours later 71010336 Anonymous (basuraabsoluta.png 975x514 14kB)
>>71010295 >'' != b'' Absolute trash

2 hours later 71010338 Anonymous
>>71010317 no it was linear scaling who said anything about pypy

2 hours later 71010353 Anonymous
Why is Jonathan Blow, creator of the Jai programming language, so entitled to save software development? Why aren't you listening to his wisdom, anon? https://www.youtube.com/watch?v=pW- SOdj4Kkk

2 hours later 71010354 Anonymous
>>71009458 the curly braces are optional

2 hours later 71010382 Anonymous
>>71010353 sounds like another cringy talk where people think writing shit software actual has a tangible effect on society

2 hours later 71010385 Anonymous
>>71010353 Jai could've been a good language, but the due to the way he's developed it, it's destined for failure.

2 hours later 71010397 Anonymous
>>71010353 >Why aren't you listening to his wisdom, anon? I like him, but I find him more entertaining than I find him wise.

2 hours later 71010406 Anonymous
>>71010382 >writing shit software actual has a tangible effect on society it does, http://blog.cleancoder.com/uncle-bo b/2019/05/18/737-Max-8.html

2 hours later 71010409 Anonymous
>>71010353 who is this and why should i care

2 hours later 71010411 Anonymous
>>71008417 what is the sauce to this image

2 hours later 71010424 Anonymous
>>71010406 Pretty sure programs that run machines aren't built on 20 layers of web frameworks

2 hours later 71010430 Anonymous
>>71010411 It's from "le ebin brograbber trap maymay", a speciality of reddit.

2 hours later 71010447 Anonymous
Question, what do I do if I want to program choices that have effect in a Choose-your-own-adventure type game in C++? Do I write it in a list of seperate conditions in an if statement? And what about nonvalid inputs, does that mean I have to resort to the godforsaken goto (labeled statement here) command?!

3 hours later 71010501 Anonymous
>>71009288 luajit still faster than v8

3 hours later 71010531 Anonymous
>>71010447 First thing you need to do is make a model of how you want your choices to affect the story. With just 10 yes/no questions, you have 2^10 = 1024 possible story routes. Which you're probably not going to write. I'm sure you have seen one of those VN guide flowcharts, right? Make a flowchart like that, detailing all your routes. Flowcharts can be represented as node graphs, and since it's linear/directed (you can't go back once you've made a choice), you basically end up with a tree/trie.

3 hours later 71010534 Anonymous
>>71010430 >>71010430 FFS >Finally get a job in tech after years of being a nerd >No education, self taught, meeting with CEO and lead programmer next week for my internship >now everyone is talking about how they're fucking gay i am a romantic motherfucker and wanted to read a story about a young rouge who is learning to code because a cute girl is drawing him into the club not this gay shit

3 hours later 71010535 Anonymous
>>71010447 FSM

3 hours later 71010551 Anonymous
>>71010534 cute girls don't program

3 hours later 71010565 Anonymous
>>71009773 lol no

3 hours later 71010594 Anonymous
>>71010531 Oh. Thanks man. I just need to make a flowchart for shit, and write out each ending. It'd be a massive program spanning over thousands of lines, but so freaking worth it. But the question is, do I write all those statements within the if statement once I made a choice or no?

3 hours later 71010596 Anonymous
>>71010353 He tends to ignore parts that he personally didn't experience. There should as little abstraction as possible, everyone should understand low-level details in order to make effiecent software, he basically says. That's why Ericsson developed Erlang, dynamically typed functional language for real-time telephony that worked on extremely distributed and robust systems by guaranteeing things, restricting things, abstracting things. There are also strange strawmen, like LSP (I described it in >>71010431 ). That's just the continuation of his tendencies to make every statement absolute (like I said in >>71008793 ). To make something a separate, abstracted part is an engineering decision with tradeoffs and complexities, not a binary good/bad decision. As Borges wrote: "To think is to forget a difference, to generalize, to abstract".

3 hours later 71010601 Anonymous (0bcc2718d4c76c676637eba42829fba04610d0d6_full.jpg 184x184 15kB)
I am a data scientist. Recently, i have decided to make a startup and build a web-app for it. That was the worst decision i've made in my whole life. Fuck. The thing is i wanted a serverless web-app and invented and algorithm that works flawlessly on users's machine and writes the results at DB. But to do that, i've had to use javascript. What an atrocity. It is physically painful to code. WHY? WHY THIS LANGUAGE HAS COME TO EXIST. JUST WHY. Who likes it? Who, on his own free will chooses this abomination, this holocaust of human souls as their primary language. JUST WHY?

3 hours later 71010622 Anonymous
>>71010601 You need to inhale, calm down, exhale, and be thankful that you're not writing COBOL in the middle of 60s.

3 hours later 71010625 Anonymous
>>71010601 People like you. People who don't think things out clearly at first and then soon make regrets here on this board. It's why I will never touch Javascript, and don't get me started on it's autistic uncle Java, relying on prolix and verbosity to look "sophisticated"

3 hours later 71010630 Anonymous
>>71010594 >>71010535

3 hours later 71010637 Anonymous
>>71009746 >>71009730 In C++ this is just const uint8_t value = []{ switch (condition) { case 0: return foo; case 1: return bar; default: return baz; } }();

3 hours later 71010678 Anonymous
>>71010594 >But the question is, do I write all those statements within the if statement once I made a choice or no? Probably not. Usually when there is a choice, the story branches out a bit, and then merges back together. You would do something like ask the player which date he wants to go on, and then if (input == date1) { date1(); } else { date2(); } // game continues here with what happens after the first choice

3 hours later 71010680 Anonymous
>>71009730 const uint8_t value = condition == 0 ? foo : condition == 1 ? bar : baz;

3 hours later 71010718 Anonymous
>>71010678 Fair enough. I have done that before, but I want it to have an effect of what choices you do. It'd be a massive bastard but it's comprised of if, else if, else statements. I would use switch, but I have a very limited grasp on C++ and would rather stick to integer values.

3 hours later 71010822 Anonymous (7drHiqr.gif 312x213 996kB)
https://twitter.com/ca3studio/statu s/1129891735201624074 Pls rate my shitty MIDI player. took me two days to make because I am dumb.

3 hours later 71010871 Anonymous
>>71010622 Wew, i've been writing PROLOG

3 hours later 71010920 Anonymous
When defining a const member function in a sepples, is it correct to use the decltype like this auto func(void) -> int const { return x; } I want it to be equivalent to int func(void) const { return x; }

3 hours later 71010931 Anonymous
Can someone help me with a python project. I have to make a program that stores employees, id number, their department, title, and salary. I have to use a dictionary for this. the keys are the employees names. but what should the values be? I will need to be able to do things like count employees in each department, display average salary for each department, etc. just looking if the value in my dictionary should be a list, set, tuple, etc. I think I am being encouraged to actually have it be another dictionary but that is making my head hurt even more

3 hours later 71010976 Anonymous
>>71010931 That doesn't make sense to me Can't you just store an array of employee objects and access the values per object or something?

3 hours later 71011068 Anonymous
Should we have a "fallthrough" statement instead for switch cases and make break the default?

4 hours later 71011155 Anonymous
>>71011068 No

4 hours later 71011169 Anonymous
>>71011068 What the fuck are you talking about? Default *is* the fallthrough.

4 hours later 71011171 Anonymous
>>71011068 All sane languages do this already

4 hours later 71011178 Anonymous
>>71011169 you misread what he said, he's asking to make fallthrough explicit

4 hours later 71011188 Anonymous
Which language has the best list comprehension syntax and why?

4 hours later 71011240 Anonymous
>>71010920 shouldn't that be: auto func(void) const -> int { return x; }

4 hours later 71011261 Anonymous
i implemented a shitty tuple because i didnt realize what i wanted was a tuple template<bool condition, typename Default, template<typename...> class hkt, typename... Ts> struct ConstructIf {}; template<typename Default, template<typename...> class hkt, typename... Ts> struct ConstructIf<true, Default, hkt, Ts...> { using type = hkt<Ts...>; }; template<typename Default, template<typename...> class hkt, typename... Ts> struct ConstructIf<false, Default, hkt, Ts...> { using type = Default; }; struct MemeTupleBase { }; template<typename T, typename... Ts> struct MemeTuple : public ConstructIf<(sizeof...(Ts) > 0), MemeTupleBase, MemeTuple, Ts...>::type { T val{}; using super_type = typename ConstructIf<(sizeof...(Ts) > 0), MemeTupleBase, MemeTuple, Ts...>::type; template<typename T_ARG> T_ARG& get() { if constexpr (std::is_same_v<T_ARG, T>) { return val; } else if constexpr (!std::is_same_v<super_type, MemeTupleBase>) { return super_type::template get<T_ARG>(); } } };

4 hours later 71011279 Anonymous
>>71011261 Yikes desu senpai C++ needs to be aborted ASAP

4 hours later 71011303 Anonymous
>>71011261 nice, I like when people post clusterfuck C++ metaprogramming so I can play a little game of trying to digest it

4 hours later 71011305 Anonymous
>>71011261 nothing gets me harder than templated C++ code the bigger the better

4 hours later 71011306 Anonymous
>>71010976 I dont know wtf an array even is im in school, im just asking how to do what i was told to do and not once was array mentioned in class

4 hours later 71011325 Anonymous
>>71011305 Super-Size me on pointless templated C++, I want to have my brain absolutely fucked beyond belief.

4 hours later 71011344 Anonymous
>>71011188 Ruby because weird threads = Dir['*.json'].collect { |fname| JSON.parse(File.read(fname))['posts '] }.map { |t| t.map { |p| parse_post(p) }}

4 hours later 71011360 Anonymous
>>71011306 Yikes chief, sounds like you have a shit programming class.

4 hours later 71011391 Anonymous
>>71011261 >want to unpack tuple into values auto tup = std::make_tuple(1, 'c', "foo"); int a; char b; const char *c; std::tie(a, b, c) = tup; >can't use auto, have to declare separately this is what makes me jealous when I read the rust docs

4 hours later 71011422 Anonymous
>>71011391 In C++17 this is just: auto tup = std::make_tuple(1, 'c', "foo"); auto [a, b, c] = tup;

4 hours later 71011433 Anonymous
>>71011344 ruby is pretty gud. gives me the .net feel

4 hours later 71011459 Anonymous
>>71011422 well that's nice, I'll see if my project compiles in C++17.

4 hours later 71011464 Anonymous
>>71011422 Surely you can just do auto [a, b, c] = std::make_tuple(1, 'c', "foo"); ?

4 hours later 71011476 Anonymous
>>71011459 Technically it should but you may get deprecation warnings about some things that have been marked as deprecated so if you build with -Werror then it may not compile because of those, should be simple enough to fix. >>71011464 Yes, of course, that was just meant to demonstrate he doesn't need to use the variables and std::tie in modern C++ to unpack a tuple. It's called structured binding, and it can be applied to std::pair as well as structures, so you can do funky stuff like this: struct Foo { int bar = 0; int baz = 1; }; Foo foo(int a, int b) { return {a, b}; } auto [bar, baz] = foo(1, 2);

4 hours later 71011485 Anonymous
if your language uses { } instead of [ ] for lists, it is pure shit.

4 hours later 71011489 Anonymous
>>71011325 >Super-Size me on pointless templated C++, I want to have my brain absolutely fucked beyond belief. I think this feature is more harm than good template<typename T> constexpr T pi = T(3.14159); // Usual specialization rules apply: template<> constexpr const char* pi<const char*> = "pi";

4 hours later 71011492 Anonymous
>>71011391 you cant even access tuple elements by type in rust and its only implemented for up to 12 elements because weak type system

4 hours later 71011529 Anonymous
>>71011492 >he's not making this up oh no no no no, how will rustlets ever recover? https://github.com/rust-lang/rust/b lob/master/src/libcore/tuple.rs#L11 0

4 hours later 71011536 Anonymous
How do you guys feel about C#?

4 hours later 71011537 Anonymous
>>71011485 If your language uses [] instead of () for lists, it is pure shit.

4 hours later 71011544 Anonymous
>>71011536 Literally Java

4 hours later 71011546 Anonymous
>>71011536 Love it, best language for me

4 hours later 71011562 Anonymous
>>71008417 >daily programming thread >at least three times a day >>71011536 one of the top high level languages

4 hours later 71011580 Anonymous
>>71011529 lmao I've seen similar retardation in Haskell and Java as well

4 hours later 71011585 Anonymous
>>71011536 I've been using C# for like 4 years. People used to hate it because of it being "exclusive" to Windows, these days you can use it on all platforms. .Net Core is awesome.

4 hours later 71011589 Anonymous
>>71011580 JCL is so shit it doesn't have this problem.

4 hours later 71011603 Anonymous
>>71008417 >What are you working on, /g/? Going full pajeet. Compiling a kernel for an old Galaxy Nexus.

4 hours later 71011604 Anonymous
>>71011536 It has C in its name. Sounds like a warning to avoid it, kind of like poisonous frogs having bright colors.

4 hours later 71011618 Anonymous
>>71011536 C# is meh, it's basically just microsoft java However, .NET as a whole seems to have an air of quality that the JVM don't. And honestly microsoft are not as cunty as oracle, who are literally trying to destroy software development because they can't innovate anymore.

4 hours later 71011628 Anonymous
>>71011360 plz halp

4 hours later 71011632 Anonymous
>>71011422 >>71011459 Best thing about this is that you can use const for the structured binding. Just be mindful that the variables are actually just references, so make sure you actually do mark them const for lifetime extension in case you actually do use temporaries there.

5 hours later 71011648 Anonymous
>>71011628 You will now learn about recursion: >>71010976

5 hours later 71011669 Anonymous
>>71010931 >>71011648 But otherwise yes, the solutions you suggested should all work. The easiest one of them is probably a tuple, but that is not exactly the greatest programming as very large tuples can get a bit messy. You could have a class Employee with the fields you specified, and have an instance of that as value that you map to from the employee name or id or something.

5 hours later 71011695 Anonymous
>>71010931 literally everything in python is a dictionary it's perfectly natural to nest them fucked up that the primary key is supposed to be name and not ID though

5 hours later 71011718 Anonymous (c2d.jpg 663x579 39kB)
>>71008417 >need to grind out projects and leetcode during the summer to get ready for job hunting >this last years worth of Uni projects makes me not even think about programming

5 hours later 71011719 Anonymous
>>71011632 So I will actually invoke UB unless I do const auto [a,b,c] = returnsTuple(); ?

5 hours later 71011788 Anonymous
>>71011719 No, because const ref guarantees lifetime extension, that's why I said be careful.

5 hours later 71011841 Anonymous
>>71011788 >>71011719 Wait, I'm dumb, it's late, you know what I meant. Just read the cppref page, it explains everything perfectly. https://en.cppreference.com/w/cpp/l anguage/structured_binding

5 hours later 71011874 Anonymous (multiretmultilet.png 534x662 47kB)
Added support for multi return and multi assign in my programming language. Probably gonna add something like >>71011422 tomorrow for structures and arrays.

5 hours later 71011891 Anonymous
>>71011628 class SlaveDriver < Hash def hire(emp) self[emp[:name]] = emp end end company = SlaveDriver.new bob = { name: 'bob', id: 8, dept: :sanitation, title: 'junior custodian assistant', salary: 12 } company.hire(bob) Keying by name is really dumb though

5 hours later 71011903 Anonymous
>>71011874 now do discards and disallow 'o' at compile-time

5 hours later 71011908 Anonymous
>>71011903 I would if it was a compiled language.

5 hours later 71011916 Anonymous (Anime_eae0e1_6308880.gif 540x304 98kB)
>>71011788 >>71011841 no sorry, I looked at that section and it goes neck deep into C++ specific concepts. I'm too dumb for C++, for now I'm hoping what I understood from https://abseil.io/tips/107 is correct and I'm putting const auto& as my type since I'm not modifying it anyway

5 hours later 71011975 Anonymous
>>71011916 DESU, that is not really C concept. C++ is trying to implement things from other languages.

5 hours later 71012108 Anonymous
toml is nice it's like .ini but sensible

5 hours later 71012112 Anonymous
I hate any of linux DEs, their scalings and so on. Can I write my own DE which is clone of MacOs's one? Really

5 hours later 71012118 Anonymous
>>71012112 go ahead

6 hours later 71012136 Anonymous
>>71011975 what I'm saying is, I know what lvalues are rvalues are, concepts from other languages. I've never heard of prvalues or xvalues, or perfect forwarding, or rvalue references, or universal references or whatever else, before C++. somehow none of the other languages have such a complicated spec

6 hours later 71012141 Anonymous
>>71012112 Have you tried elementaryOS's Pantheon DE?

6 hours later 71012153 Anonymous
>>71012112 Why not just use Cinnamon? It's literally windows 7 desktop and Linux probably runs as many programs as windows 7 now that it's 2019.

6 hours later 71012161 Anonymous
>>71012153 I meant Mate desktop. Cinnamon is a Mint thing.

6 hours later 71012163 Anonymous
>>71012112 Of course you can write your own DE, although it i a lot of work.

6 hours later 71012174 Anonymous
>>71012136 i think that is from python list manipulation.

6 hours later 71012178 Anonymous
>>71011874 Is this open source?

6 hours later 71012183 Anonymous
>>71008603 name?

6 hours later 71012207 Anonymous
>>71012178 Not until I finish the remaining 50~ things on my todo list which will take a while, I've only been working on it for a month or so.

6 hours later 71012221 Anonymous
>>71012207 That's fair, good luck to you.

6 hours later 71012244 Anonymous
>>71012221 Thanks, unfortunately I don't have much time to work on this side project but I'm working on at least one thing a day - however small. Ultimately it's something that I want to use myself, not something that I necessarily want others to use, so some decisions may end up looking weird to outsiders but I won't mind releasing it either. Here's the git log so you can see that some of these days I was just working on shitty mundane non-progress things: https://pastebin.com/raw/rm3KmT2n

6 hours later 71012245 Anonymous
>>71012207 tell us about your language anon

6 hours later 71012254 Anonymous
>>71012136 >I've never heard of prvalues or xvalues they're just very specifically designed subsets of r or lvalues from the c++ spec for defining what compilers are allowed to do with them

6 hours later 71012280 Anonymous
>>71012244 That's cool anon, thanks. It's the same way for me and my side project.

6 hours later 71012283 Anonymous
>>71012136 >prvalues or xvalues basically, two language features >guaranteed copy elision stuff you return from a function doesn't get copied >the ability to define an object as non-copyable or non-movable didn't interact well so they made up two new value types in order to handle cases where those features interact >perfect forwarding take an lvalue or an rvalue and turn it into a universal reference so you don't have to write 4 times the amount of templates >universal references when you're fucking with templates, (more specifically, when you're in a context where the compiler has to figure out what type something is) && does not mean rvalue, it means lvalue or rvalue, and the compiler figures out which, to make it easier on the programmer

6 hours later 71012339 Anonymous
How do you make a Tally in C++, Like as in all the numbers add up.

6 hours later 71012358 Anonymous
>>71012283 actually really helpful, thanks

6 hours later 71012370 Anonymous
>>71012339 uint8_t tally = all_the_numbers + up;

6 hours later 71012398 Anonymous
>>71012370 If that is a meme, good game. otherwise, I'm looking to have certain strings refer to certain events that can't be normally obtained. Having super specific variables like 1b dictate how certain events play out.

6 hours later 71012459 Anonymous
>>71012358 i forgot rvalue references an rvalue reference is a reference that binds to an rvalue remember that references are basically just non-nullable pointers its for passing temporary objects by reference instead of by value useful for moving things, for example struct foo{ int bar{0}; }; void func(foo&& rvalue_ref){ //func takes ownership of whatever's passed to it, and it is destructed when func returns } void temp_func(){ //passing temporaries func(foo{100}); } void move_func(){ foo movable{100}; func(std::move(movable)); //iirc movable is empty now, and func owns its original contents, which go out of scope when it returns }

7 hours later 71012648 Anonymous
How can I protect my program against cosmic rays flipping bits?

7 hours later 71012656 Anonymous
>>71012648 lead shielding

7 hours later 71012657 Anonymous
>>71012648 ECC

7 hours later 71012661 Anonymous
>>71012648 use a verified language.

7 hours later 71012671 Anonymous
>>71011891 >>71011695 thanks, yeah i thought keys being the ID would make more sense but gotta do it the way he says I guess

7 hours later 71012712 Anonymous
>>71012339 >>71012398 It was sarcasm. That poster’s response and the lack of responses that you are getting is due to the fact that your question is poorly asked and makes little sense. Please consider researching “how to ask a programming question” before trying again.

7 hours later 71012735 Anonymous
>>71012712 Thanks Anon. I was looking for certain variables to have certain events play out. But, I solved it on my own anyway.

7 hours later 71012764 Anonymous
Are no integer square roots nor division a standard feature of functional languages? isprime n = [i | i <- [2..n - 1], n `mod` i == 0] == []

7 hours later 71012771 Anonymous
>>71012648 checksums and error correction Depending on what you are doing, you will still likely need a hardware watchdog timer Think of it as shared memory multithreaded programming except you have no idea what the other thread is doing, when it is doing it, or why.

7 hours later 71012792 Anonymous
>>71012764 not necessarily, there was some autism involved when people decided the basic numeric hierarchy for Haskell you can always convert to a double or something

7 hours later 71012814 Anonymous
What is a reasonable buffer size for IO? 4 KB? 64 KB?

7 hours later 71012827 Anonymous
>>71011536 It's like Java if Java were good.

7 hours later 71012865 Anonymous
>>71009128 Only if you sit on my lap

7 hours later 71012933 Anonymous
>>71012814 256MB

7 hours later 71012957 Anonymous (parprog.jpg 274x360 24kB)
I heard Simon was based, is his book good?

7 hours later 71012967 Anonymous
>>71012933 Thanks you very much for this answer :)

7 hours later 71012970 Anonymous
>>71012661 That's not what formal verification does though, the prover assumes your computer doesn't randomly output wrong answers for intermediate results

7 hours later 71012971 Anonymous
>>71012764 integer division is `div`

8 hours later 71012999 Anonymous
>>71012648 I don't know ask the electrical engineers.

8 hours later 71013040 Anonymous
>>71012648 shielding, error correction and checksums. systems which worry about those problems are also very redundant, running multiple servers in parallel which can be hot swapped to if the master's is corrupted and needs a rebooting.

8 hours later 71013093 Anonymous
>>71008417 >koku haku more like cock hack

8 hours later 71013192 Anonymous
>>71012648 multithreading. keep 3 copies of your program state and run any critical operation 3 times in 3 separate threads. decide on the canonical result of each operation by consensus

8 hours later 71013202 Anonymous
>>71013192 What if a cosmic ray flips a bit during consensus?

8 hours later 71013222 Anonymous
>>71013202 hopefully you can detect something is bad through another check and reset the system to return to a stable state.

8 hours later 71013224 Anonymous
>>71013202 use a punch-card mainframe made of vacuum tubes for the final consensus calculation all the hardware should be too large in size for cosmic rays to have significant effects

8 hours later 71013229 Anonymous (1539026946781.png 600x679 307kB)
Why do people use floating points? Why not use integers for everything? You can interpret the meaning of 1 integer to be the maximum level of precision. If you want more precision then simply reduce the measurement size of 1. It seems to me like integer vs floating point is just an arbitrary difference. Like anything that can be done with a float can practically be done with an int.

8 hours later 71013239 Anonymous
>>71013229 what anyway floating point is (mostly) x * 2^y

8 hours later 71013240 Anonymous
>>71013229 cute retard poster

8 hours later 71013268 Anonymous
>>71013229 you would need to have separate bits on the side to say what the actual exponent was for your fixed-precision number anyway and in fact, floating point numbers do exactly that if you have less than 23 / 51 bits of precision. they only get rounding errors if you move past that if you need arbitrary-precision arithmetic with absolutely no rounding then there are ways to do that but it will be much slower since there isn't specialized hardware to handle it

8 hours later 71013270 Anonymous
>>71013229 you're asking the question of floating point versus fixed point without realizing.

8 hours later 71013276 Anonymous
>>71013229 floats have variable precision, you can use them for very big and very small numbers at the same time, which is essential for doing alot of math

8 hours later 71013294 Anonymous
>>71013240 She's actually right though. You can just create a mapping between the integers and the reals. Floats are dumb.

8 hours later 71013296 Anonymous (scrot.png 1920x1080 399kB)
>>71008417 >What are you working on, /g/? Downloading android sources so that I can hopefully compile them.

8 hours later 71013303 Anonymous
>>71013294 >You can just create a mapping between the integers and the reals. you cant you can create a mapping between ints and fixed point, not floating point

8 hours later 71013310 Anonymous
>>71013303 >floating point I said reals

8 hours later 71013317 Anonymous
>>71013310 the poster said floats

8 hours later 71013321 Anonymous
>>71013317 Yeah and I said reals

8 hours later 71013324 Anonymous
>>71013294 maybe if you're a mathematician playing with an idealized turing machine real life processing units will have a limited word size of 64 bits and will be able to represent only an infinitesimal fraction of integers

8 hours later 71013333 Anonymous
>>71013324 Ok? I know that.

8 hours later 71013335 Anonymous
>>71013321 well you also said he was right and hes not

8 hours later 71013347 Anonymous
>>71013335 Except you can create a mapping between ints and floats.

8 hours later 71013352 Anonymous
>>71013347 sure, an inaccurate one

8 hours later 71013357 Anonymous
>>71013352 So just like floats. Where's the problem?

8 hours later 71013358 Anonymous
>>71013333 which means she isn't right you can't do "anything that can be done with a float" with an int, because there are real numbers which can be easily represented by a float but which would require impractically many bits of memory to represent as an integer

8 hours later 71013367 Anonymous
>>71013357 what?

8 hours later 71013368 Anonymous
>>71013352 i can create a perfectly accurate, lossless map from any float64 to any int64 int key = *(int*)(&float_value);

8 hours later 71013374 Anonymous
>>71013358 Uh, I hate to break this to you, but floats ARE integers. A float is literally just a 32bit int with a different interpretation. Floats literally ARE just a mapping from integers. It's just that the mapping is slightly non trivial.

8 hours later 71013376 Anonymous
>>71013368 what if sizeof(float) == 8 and sizeof(int) == 4?

8 hours later 71013380 Anonymous
>>71013367 Floats are an inaccurate mapping to the reals.

8 hours later 71013397 Anonymous
stop being retarded

8 hours later 71013399 Anonymous
>>71013397 That would mean deleting the thread.

9 hours later 71013485 Anonymous
New thread: >>71013480 >>71013480 >>71013480

9 hours later 71013527 Anonymous
>>71011718 lol same

9 hours later 71013533 Anonymous
>>71013358 >there are real numbers which can be easily represented by a float but which would require impractically many bits of memory to represent as an integer such as?

9 hours later 71013704 Anonymous
>>71013533 a 64-bit float has a 12-bit signed exponent, meaning it can represent values up to about 2 ^ (2^11 - 1), or 2^2047 To represent such a number in a naive integer format with no rounding would require 2047 bits of memory.

10 hours later 71013917 Anonymous
>>71013704 You have absolutely fucking no idea what you're talking about. Floating point IS an integer format.

10 hours later 71013940 Anonymous
>>71013917 i don't think you understand what an integer is yes any series of bits can be interpreted as a base-2 integer but that doesn't mean that literally all binary data in existence is an "integer format"

10 hours later 71013952 Anonymous
>>71013940 Actually yes it does.

10 hours later 71013959 Anonymous
>>71013952 >>71013917 Wow, what a fucking useless definition of "integer format" then.

10 hours later 71013976 Anonymous
>>71013959 My point is you don't need 2047 bits. Proof: floats. Learn what a map fucking is.

11 hours later 71014348 Anonymous
>>71013976 How would you do arithmetic efficiently on numbers which require remapping their bases? The primary motivation of floating point is to allow very small and very large numbers to be represented with a single number type so we can efficiently operate on them.

11 hours later 71014424 Anonymous
>>71014348 Ok? Please realize your post is retarded. >How would you do arithmetic efficiently on numbers which require remapping their bases? what? stop being retarded

11 hours later 71014443 Anonymous
>>71014424 More retarded than the guy claiming floats are pointless and providing no evidence why?

3.443 0.249