Old thread: What are you working on, Sup Forums?
/dpt/ - Daily Programming Thread
Daily reminder that if your language can't shuffle actions, then it's shit.
Daily reminder that coders aren't the same as programers
Daily reminder that coders is a misnomer, you aren't writing code, you're writing instructions in a structured and readable language that is interpreted or translated/compiled into something your computer can execute.
can someone recommend me a good book on writing JS that isnt shite?
Daily reminder that all programming languages are shit, and programming is a retarded waste of time.
In python I want to return the value or 0 if the value is lesser than 0
I have the feeling there must be a simpler way than what i came up with
( filter(
( lambda x: x > 0 ), list((-4,)) )
or [0]).pop()
This picture confuses me.
depends. All JS is shit so hrm.
nope, JS is shit, so their books can only be worse
shes autistic
but i need to learn web dev in a matter of days
return value if value >= 0 or 0
What? What is this "web dev" you speak of? What could it possibly mean?
This shit is what happens when Lisp programmers attempt writing imperative language.
Bullshit, no self-respecting lisp programmer would fuck up their parens that badly.
return value > 0 ? value : 0;
basically i need to learn how to do OOP in the browser with JS
why? even if you are really good at it, you will only produce crap in a saturated pile of crap called "internet". Make the humankind a favor and stop using scripts on websites.
i need to land a job with a web based company
why is python's ternary operator so fucked
Because you shouldn't use ternaries in the first place, they convolute your code.
That's ok, you are young, need that little money to convince your woman to reproduce and shit. But guess what? you don't need to be good at it, you just need to convince the employer. Then he will say: why should I pick you instead of Mr. Rajeesh when he cost me only $22k at year?
JS the good parts.
JS might not be the best.
But its certainly not shit
Look at the series of books 'You don't know JS' if you really want to understand the inner workings of javascript prototypal system (which is shit)
If you don't understand that, you'll set yourself for a future suicide
Trying to create a program which given a language computes whether it's shit or not.
Here: return true;
excepting lisp languages. them being programmable programming languages, they are only as shitty as you make them to be.
Pic related is what happens internally once you have the bad idea to try to mimic OO code in a language that was primarily built for behaviour delegation
Javascript IS shit. And this comes from someone who uses it daily for most of his coding
they are shit by themselves, and being programable you can make them utter shit
>them being programmable programming languages
What are you going to mean by that?
>lisp is perfect until the programmer makes it shit by actually programming in it
All languages are perfect until anyone tries to actually do anything in them
Making my compiler user-friendly.
>All languages are perfect
Nope. Any POOlang is defined to be shit.
Also, prototypal delegation is fundamentally flawed as a sytem to emulate class-oriented languages, and creates all sort of problems, pic related being just one of the more apparent
There's plenty of subtle, catastrophic situations you may run into in this horrible language if you need to create anything that is not trivial
>I failed Introduction to Java and now I'm going to rant about it on Sup Forums - the post
kek
what's wrong in your example?
I wouldn't ever study C*. I'm not subhuman.
why is this allowed Sup Forums
>wanting to learn OOP
>not learning Smalltalk, OCaml or at least Simula-67
Pleb
I know at least one of those languages. It doesn't change the fact that any POOlang is defined to be shit.
>What are you working on, Sup Forums?
enterprise quality lisp interpreter in java. I already have 17 classes and it doesn't even do anything yet :^)
>doesn't know how floating point works
>:^)
>POOlang is defined to be shit.
Reported for being under the age of 18.
le mad?
fuck off
btw I'm going to take a break and work on my video game in electron javascript html css for a bit
>reddit spacing
>his ""language"" doesn't support real numbers
What is numerical analysis and what relation does it have with computers
fucking this
STOP
FUCKING
USING
SCRIPTS
ON
WEBSITES
MOTHERFUCKERS
WEBDEVS
Fuck off, grandpas. I like getting push notifications.
then "push" them deep into you anus
no, that was actually double reddit spacing
>>=
>or
do you also put a break statement after returning the value?
'just to be sure
I am about to finish E Sports betting website. Wrote it with JS. I gave money to freelance designer. Soon ship it with advertisements.
The or is obviously a mistake, it should have been else.
>= is just autism. Technically, if value is 0, it isn't less than 0. In this case it doesn't really matter, because it will return 0 when value is 0 either way.
Why not
can this statement be done with using value only once
same here
Fuck off tripfags
But user, it's impossible for a computer to support real numbers.
pee pee head
>not having a decimal computer in a shielded room
I'm not going to fuck off anytime soon
But there exists real numbers which are not algebraic, so a computer cannot possibly have a representation for all real numbers.
tmp = value
return tmp if tmp >= 0 else 0
figures you'd be a pajeet
welcome aboard
?!?!
I don't think so. But you can use function like
return ((value+abs(value))/2);
return value < 0 ? 0 : value
>what is RSS
Or something like this
#include
#define X(a) a*(a>0)
int main() {
int value1 = 5;
int value2 = -5;
std::cout
I got it
return max(0, value)
._.
I am dumb
return {'v': x for x in [value] if x > 0}.get('v', 0)
Just define the type of real numbers.
maybe, but I got you job, redneck
import std.stdio;
void main()
{
sum(34, -9.34).writeln;
}
auto sum (real x, real y)
{
return x+y;
}
$ rdmd main.d
24.66
And yet "under the hood" value is used more than once
Since when did python have monads?
Floating point garbage.
this is beautiful actually
Where does the word "float" appear in the post you replied to?
@61025322
Do you even study your own retarded language?
dlang.org
61025351
Where did I claim so/otherwise?
^
Fuck you and your ignorance.
Is this the new GNU/Linux copypasta?
How does one exactly represent pi in such a system?
Most likely since its unfortunate inception.
7/22
pi = 16 * atan (fromRational (1 % 5))
- 4 * atan (fromRational (1 % 239))
Does this terminate?
Does this have infinite precision?
Yes to both
But that literally cannot fit into memory. I feel like you're lying.
3
Is C a good language to learn stuff in without being raped my language specific ideologies and libraries? I just want to be able to type stuff into like notepad++ or some alternative, build the code, and then see if I made something faster or shittier or better.
I've been programming for about two years now. I've used mainly C# but I'd like to learn how to write platform independent code (or rather code that IS native code but has an easily transferable entry point and minimal platforms specific dependencies so its basically actually cross platform, however is not a runtime language). I've also used Python, Lua, Java, minimal C and C++, and I've been using Godot for game development which uses its own scripting language that's similar to Python.
Somewhere down the line I'd like to make cool games that are heavily data structure/design based and far less graphics based (think games like Out of the Park Baseball, Dwarf Fortress[though I know DF is actually a rather unique type of design because it is REALTIME and the gameplay is directly tied to the actual FPS/Pathfinding etc, it functions more like a physics simulation based game than it first appears.])
Anyways I have no formal education, game programming books mainly discuss graphics rendering and code structure in terms of an entity component type based thing with viewports and whatnot, I've been reading "Game Coding Complete 4th Edition".
Basically what I'd rather learn right now is.
>The tools that work now and are being worked on in order to process and tranform data
>How to design programs that efficiently make use of those tools.
By tools I mean "a dictionary" but I also mean "XML or JSON". I realized what I'm looking for will not be condensed into one book or resource. The reason I was asking about C is I'm looking for a blank language that I can use to try out stuff that I read in articles and books and to legitimately learn with. I'd like to be able to become competent within 10 - 12 years.
Stores it as a function.
Try it yourself if you don't believe me: hackage.haskell.org