Old thread: >>60933273
What are you working on, /g/?
C++ belongs to garbage bins
Inheritance and subclassing is the wrong way to do OOP
>>60937039
Agreed
>>60937039
Any way is the wrong way to do OOP.
We are making a web browser http://magicpackets.net:3000/proudfeet/netrunner
To join the team contact [email protected]
What is a ``FROB''?
There's already a /dpt/
>>60936655
>>60936655
>>60936655
>>60937053
Netrunner is a copyright'd name.
>>60937063
>Posted before the bump limit
>/v/ shit
>Doesn't follow /dpt/ format
Invalid. Delete that shit.
>>60937077
fine, you win this time. Anime is still for children, though.
>>60937053
If /g/ / /dpt/ can't even work together to make something like a torrent client, what makes you think it can make something WAY more complicated like a web browser?
Or is this just "UI on top of WebKit #13125"?
>>60937091
they are forking links
>>60937091
>UI on top of WebKit
no
>>60937093
>anime trash
I can't delete the post now, too much time has elapsed. I guess the mod gods will eventually delete it.
>mods on /g/
kek
>>60937113
All you need is C++, Lisp, and C for interop
>/dpt/ - Dead programming thread
B-lang had the right idea about types: namely, they're unnecessary. Everything should just be a word, and how it's interpreted should be decided entirely by what function is called on it.
There's literally nothing you can't do this way that you could do with types.
>pointers
If the memory is word addressable, use a word. If not, store the multi-word address at a word addressable location.
>strings
Use a word that addresses an array of words. Write a function to read a byte from memory into a word and return that word; use that function to iterate over the characters.
>structs
Same thing, array of words. Write accessor functions and manipulation procedures that handle regions of the array in the desirable manner.
Prove me wrong /g/
>>60937342
Didn't B mandate 36-bit types or something weird like that?
Is there a way to make a local dynamic web page without open a server and a database? I mean, save all my DOM changes and all that stuff. Please don't bully the web-fag.
>>60937363
No, B just straight up had no types. Correction, B had one type that had no name and was equivalent to C's int. Only type you need.
>>60937371
Sure, it had the "word" type, but it said that a word was 36-bits or something silly.
It's been a while since I've read the B description, but I remember it being utterly inappropriate for modern hardware.
>>60937342
>>60937371
You need at least one type to be a programming language.
>>60937366
>web page
Why the fuck did you think this was appropriate for this thread? Please ask your web related questions on >>>/g/wdg/
>>60937393
>he gatekeeps on dpt
>dpt is a webpage
>>>/g/wdg/
>>60937417
>dpt
What?
>>60937421
you're currently using a webpage
real programmers don't use webpages
>>60937009
Is there a license which would prohibit black people from using my language?
Or are there some other ways to accomplish this?
>>60937429
No, what is ``dpt''?
>>60937342
or just use a weakly typed language like C.
your proposed methods of supporting pointers, strings, and structs is essentially making types just without the syntactic sugar of types in other languages like int, string, int[], etc.
>>60937381
In what sense do you mean type? Is a machine register a type in assembly?
>>60937366
You can't, but you can imitate it with either cookies or more preferably localStorage. Just store the state of the client on the machine so it seems like they're using a server each time they visit.
>>60937087
Only children's anime, actually, but I'll watch those too sometimes
>>60937429
>real programmers don't use webpages
haha
>>60937442
Obviously illegal in many countries (not all, desu most discrimination/hate crimes have to do with employment, being a customer, or violence), but you could quite directly put that restriction as an addendum in any regular license and it'd... well, still never hold up in court. https://en.wikipedia.org/wiki/Douglas_Crockford#.22Good.2C_not_Evil.22
>>60937386
I'll cross post my post from other thread since we warring now. Thoughts on getting over failure anxiety?
>>60937562
Forgot about the word filter desu.
>>60937571
For me, watching my GitHub turn into a graveyard (meaning a few more misses isn't so bad) and then pinning the success was helpful. If you put out the failures anyway then all of a sudden a failure as a unit isn't so drastic anymore. And if someone's interested in looking at your history developing things, they'll see you were working on SOMETHING during that time.
https://youtu.be/RT46MpK39rQ?t=25m55s
>>60937607
Hmm that's pretty good sounding advice. So you just work on things, get sick and bored or them, move on, leave them on your git accounts and don't worry about it?
How am I supposed to map a macro?
Is there a short way to do this(mapc (lambda (x) (macro x)) seq)]
>>60937717
The macro will expand before runtime, so visualize the macro in your map being replaced by the full code it expands to. I think it would still work.
>>60937690
Yeah, that's the idea. Gets you more used to planning new projects and doesn't turn your initial commit into a marriage proposal. Ideally you want to capture the ones that both strike your interest best and you feel you have a good plan to finish, and push those to completion.
Speaking from experience, it's also good for your career to have a collection of those on your github profile.
i hate video games, what do?
>>60937874
Write a game engine.
>>60937880
already partially have
>>60937888
Learn an obscure language and then shill it on /dpt/ nonstop
>>60937903
my I wonder which regular you could be referencing
>>60937903
but i hate rust and haskell doesn't interest me
>>60937921
Which one of those is an "obscure language"?
>>60937943
everyone acts like they are
>>60937950
So?
>>60937957
i don't know
maybe i should just neck myself
Ok faggots i am getting ballsdeep into CompSci.
Starting formal studies in some months, i need some teaching materials to absolutely crush any competition i could meet, mostly because i am a huge autist who gets depressed when i meet someone more competent than me.
Hit me up
>>60937968
Since you want to feel superior to your classmates, I suggest you look at the syllabi for the courses you're taking and learn those specific things. You shallow human being.
>>60937950
Haskell totally is. Rust is too, looking at a wide scale, but it actually sees some use compared to Haskell.
>>60937968
Not being retarded should be enough. Modern CS is just dumbed down math.
>>60938032
How can a language be obscure if basically everyone knows about it?
>>60938047
There is a difference between knowing about it, and actually knowing it.
>>60937968
>press both foot pedals
top fucking kkkek
>>60938036
He's a CS major. That means he's probably taking lots of software engineering classes wrapped up in his CS degree and like 15-20% actual CS classes.
>>60938047
I think you're looking from the inside of a bubble a little bit. In the actual industry as a whole only a few languages absolutely dominate. We're talking acres of cubicles of Java, C++, Python, C# programmers - you know, the big industry general purpose players. By comparison what Rust has these days is a somewhat unique niche to fill (that it seems to do pretty well). Rust has had a lot of hype, especially on r/programming, HN and /dpt/, but in the grand scheme of things it's a systems programming language first and (probably) isn't going to be the next Java or something. (and no, I don't like Java, I just recognize how enormous and important it is)
@60938144
>especially on r/programming, HN
How about you fuck off to those shitholes?
>>60938177
Who are you quoting?
>>60938177
>@
I think you need a bit more help than I do, anon. Anyway, I was trying to be considerate, since criticism of Rust tends to be a touchy subject, but I guess it was lost on you.
>"if then else" is a """special form""" in his language
>>60938238
>I think you need a bit more help than I do, anon
I don't visit "reddit" and "HN" so I'm doing a lot better than you.
>>60938241(defmacro if (pred then &optional else)
`(cond (,pred ,then) (t ,else)))
>>60938251
I don't engage in retarded tribalism so I think I'm doing better than you. When I do visit it's because I can't exactly browse 4chan at school or work.
>>60937104
Which is so far behind competitive web browsers today that they have no hope of creating software a /g/ user would use. Or even differentiating themselves from Links 2 for that matter, most likely.
>>60938308
Is that a programming language?
>>60938144
>>60938238
>>60938321
Reddit and HN are fucking shit. The users are fucking shit. Keep your filth away from here.
>>60938321
>When I do
Please don't bring your garbage here. Keep it contained to some other websites.
>>60938328
Yes.
>>60938356
Why do you say so?
>>60938367
Because it has a standard and many compilers.
>>60938378
Why would that make it a programming language?
>>60938321
I don't want reddit stink nearby. Fuck off.
>>>/r/ibbit/
>>60938389
Because, given that standard, and compilers which follow that standard, I can make programs.
>>60938399
What kind of programs? Are you sure about this?
>>60938411
Yes.
>>60938433
"Yes" isn't a program, anon.
>>60938353
You could at least put some effort in. You gave up on the whole Rust conversation.
>>60937342
>There's literally nothing you can't do this way that you could do with types.
Wowie, you've discovered almost all programming languages are Turing-complete! That means all our programming languages are the same! Why even have more than one? Surely, with this discovery the field of compilers and language design has been entirely obliterated. How could no one have realized this sooner? The next edition of the dragon book's going to have an appendix saying "Wow, this book is completely fucking useless, I'm so sorry"
>>60938438
That's not up to you.
>>60938398
Spam is against the rules, gatekeeper
>>60938448
>You gave up on the whole Rust conversation.
I really couldn't care less about "Rust".
>>60937690
"failure" is something we define. Unless you're speaking of a setting where your performance really matters, such as work or school, you shouldn't sweat about failure. If a project starts to get tedious or dull you can just leave it be and there's no need for you to see it to its end. But you've got one thing wrong:
>if I don't start I can't fail
wrong, if you never try you always fail, and if you try and fail you can at least say you've learned something new.
Holy shit, CS exams are fucking cancer.
>>60938448
>you've discovered almost all programming languages are Turing-complete!
How can you say "almost all" when there are infinitely many programming languages which aren't Turing-complete?
>>60937442
Write it in cursive
>>60937717
Waiting for someone who knows reader macros to give me something like %macro, which translates to (lambda (x) (macro x))
>>60938455
How is it a program then? Show me.
Turing-completness is pretty overrated. Dropping it is not as restricting as you may think.
>>60938522
>"overrated"
>>60938469
Oh, my mistake. Thought you were the same anon as before. Anyway, if it makes you feel better, I don't use the other two sites that much and it really has little effect on my life. Also, I haven't watched Flip Flappers but the other two images you posted are from great shows.
>>60938484
I'm talking about the ones we use in daily life today. You can't validly talk about fractions of all programming languages until you rigidly define how you're quantifying them, which would be a lot of work and you'd get different answers depending on how you set it up.
>>60937009
C influenced languages get an automatic F in my book.
>>60938835
This, but C itself gets an A+.
>>60938835
>>60938879
C gets a C in my book
>>60937009
/dpt/ - Designated Pajeet Thread
What does it mean !String , when defining datatypes in Haskell?
I.e:data Person = Person
{ name :: !String
, salary :: !Int
}
>>60938920
Strict / not lazy
Depending on the type you can also do
{-# UNPACK #-} !T
in GHC (which will store it directly and not as a pointer)
>>60938934
Thanks for the fast reply.
Have a nice wallpaper from a non pure function..
>>60937009
How should I make my language unusable for black people?
>>60939017
>anime watching degenerate
we don't want to use your language anyways, manchild.
>>60939017
Blacks can't program anyway
>>60939046
Are you so insecure that the mere sight of an anime girl sends convulsions throughout your body and you are unable to control your desire to spam?
I really don't understand your motivation. Why are you on an anime site and yet you despise anime fans? Why not go on any myriad of other sites that better suit your interests?
>we don't want to
It's not about desire. It's about you being unable to use it due to your handicap.
>>60939054
I just want to be sure. I've seen some of them trying to program.
>>60939080
there's that one C++ committee guy
>>60939084
No wonder C++ is so shit.
>>60939093
ironically he's probably smarter than the entire C++ committee, they're all a bunch of babbling retards
>>60939133
>a black is smarter than most of the committee
No wonder C++ is so shit.
>>60939080
>racist fag is also an anime watching loser
no surprise. Obviously it's black people's fault you're overweight and ugly. If only it weren't for those darned negros. They're the reason you can't get laid and you're too scared to maintain eye contact.
>>60939200
I think you're projecting a bit too much there anon. When did he ever say any of that?
>>60939151
It is mostly shit because non programmers cannot figure it out in an afternoon
>>60939200
>anime watching loser
Please, don't say that, especially when posting on this website. Without anime 4chan would not exist. This is the truth.
>Obviously it's black people's fault you're overweight and ugly
Blacks don't have such power over me. They can't simply change reality to suit their needs.
Are you both physically and mentally weak? Is there something wrong in your life that makes you feel the need to lash out online?
>They're the reason you can't get laid and you're too scared to maintain eye contact.
I don't have blacks or any other similar filth in my country though.
>>60939289
>he watches anime
pedophile detected, pathetic and gross
@60939301
You seem to be new here. All the *chan websites are born out of anime culture.
We apologize that seems to intrinsically trigger your plebbit sensibilities.
Dear 60939305,
please return to your containment board at once
with love,
anon
>>>/a/
>>60939309
I don't visit that board. Why not go on any myriad of other sites that better suit your interests since you seem to hate anime so much. Why do you keep using a website which is based on anime culture?
>>60939321
don't ever reply to me or one of my posts again you fucking anime nigger
>>60938438
It actually is.
Open a shell and type "man yes".
>>60939347
So what body is the one that calls the shots in the US? Is there someone who everyone reports to, or is it just a mess of "government" agencies today?
>>60939389
Don't you dare disrespect our beautiful government anon, you should be ashamed of yourself. Without us, you wouldn't have any freedoms to post smug anime girls on albanian pop enthusiast forums like this.
>>60937342
Of course types are unnecessary, that's fucking obvious.
What you are missing though, is that types are convenient and allow powerful abstractions.
Go fuck yourself.
>>60939410
i abstracted my dick into your moms mouth
>>60939406
t. government agent
Wow, /dpt/ is really shit today. There's like two or three trolls.
>>60939410
Another benefit that magnifies with scale is the guaranteed type checking and static analysis. And if you have the right tools, you can code search through typed code really quickly, which is just impossible in JS.
What algorithms should I learn? What's the best way to learn them?
>>60939525
Everything in CLRS.
>>60939500
>/dpt/ is really shit today
Why?
>There's like two or three trolls
Who?
>>60939500
>guaranteed type checking
>guaranteed
What do you even mean by this?
>>60939590
i love lain
>>60937009
Playing around with traitstrait Flatten {
type Flat;
fn flatten(self) -> Self::Flat;
}
impl<T> Flatten for Option<Option<T>> {
type Flat = Option<T>;
fn flatten(self) -> Option<T> {
self.unwrap_or(None)
}
}
impl<T> Flatten for Vec<Vec<T>> {
type Flat = Vec<T>;
fn flatten(self) -> Vec<T> {
self.into_iter().flat_map(id).collect()
}
}
#[derive(Debug, PartialEq)]
struct Pettanko;
struct Cow;
impl Flatten for Cow {
type Flat = Pettanko;
fn flatten(self) -> Self::Flat {
Pettanko
}
}
fn id<T>(t: T) -> T {
t
}
fn main() {
let o = Some(Some(Some(4)));
let v = vec![vec![234, 34, 4], vec![2, 3, 4]];
assert_eq!(Some(4), o.flatten().flatten());
assert_eq!(vec![234, 34, 4, 2, 3, 4], v.flatten());
assert_eq!(Pettanko, Cow.flatten());
}
>>60939638
>Rust
Cuckold communist trash.
Good program though, at least the idea of it.
>>60939525
Go read Numerical Recipes.
>>60939638
>Flat
>not Join
>going out of your way to actively disuse the proper terminology
>>60939696
>not Join
Why would he be "joining" chest tumors?
>proper terminology
The only "proper terminology" related to the word "join" isn't in any way related to what he is doing.
>>60939751
You stupid nigger
>>60939762
>retarded Huskall notation
I see. As expected of a complete retard who would use such a deficient language.
"join" isn't "proper terminology". The only "proper terminology" I can think of is "join of categories" which isn't related to his program.
>id-law
It's not a "law" in Huskall, the language isn't really functional.
>Haskell takes 12Gb/s to collect itself
>>60939812
That isn't Haskell, that's a diagram you ducking idiot
>he needs static typing
>>60939914
Go home, python-weenie.
>>60939914
>He believes he never makes mistakes
>>60939893
>That isn't Haskell
It's written in Huskall notation, nobody else is retarded enough to write "for all" as one word.
>that's a diagram
I wouldn't call a colorized (presumably it's for children?) and dumbed down version of a diagram a "diagram".
>>60939893
it's a pretty terrible diagram
>>60939941
tdd does catch more mistakes and is easier to do with dynamic typing.
>>60939978
Only drooling retards ever write tests.
>>60939978
dumbest post of the day
congrats
why is it easier to do with dynamic typing
>>60939956
>I wouldn't call a <_> diagram a diagram
>>60939997
one example
https://www.wikiwand.com/en/Mock_object
with static typing, you have to build and handle the complexity of your types, it's just adding useless complexity to your code. in the end, the type system become a problem itself, not a solution.
>>60940004
>"I wouldn't call a <words which are equivalent to "non-diagram"> diagram a diagram" is somehow an invalid statement
Proof that parents need to beat their children more often.
What is a good course to learn the ins and outs and usage of apache http server
>When you get positive feedback from a customer on a program you've made
I never thought i'd say it but anime girl reaction faces fags are especially obnoxious in this thread
>>60940018
wrong
what is subtyping
what is row polymorphism
it's like you looked at java's type system and concluded that static typing is shit because java's type system is shit
who would've guessed that you're actually a fucking retard
>>60940020
>i-i-i-didn't make any mistake!!!!
put your trip back on ruby
>>60940042
You seem to be new here. All the *chan websites are born out of anime culture.
We apologize that seems to intrinsically trigger your plebbit sensibilities.
>>60940042
How about anime boy reaction faces
>>60940043
so a general test applicable to many types must be a subtype of all those types? yeah, not raising complexity of your code at all. but, please, don't disturb your daily fizzbuzz writing for me.
>>60940051
i haven't browsed in a month or so since my real major started shitting itself and couldn't spend time programming
the sexual dysmorphia affected males in denial were more restrained back then
>>60940057
better
>>60940048
>>i-i-i-didn't make any mistake!!!!
Point it out then. Should be pretty easy if what you're saying is correct.
>ruby
I don't use "languages" with Huskall-like deficient type systems.
>>60940072
>shinobu
A bad programmer with even worse taste.
>>60940068
>so a general test applicable to many types must be a subtype of all those types
the fuck are you rambling about you fucking retard
"a test must be a subtype of all those types hurr durr"
the fuck is this even supposed to mean
even if you replace "test" with "test function" in your dumbass comment you're still confusing values with types
are you stupid, anon?
>>60940043
>what is subtyping
Garbage.
>what is row polymorphism
Also garbage.
>>60940101
wrong until you explain your argument
>>60940069
>better
u gay son, I bet you use Swift
>>60940097
please, stop, it's obvious your never did any tdd in your (non-)programmer life.
>>60940096
>A bad programmer
Why do you say so?
>with even worse taste
Is this what it has really come to? We're here for you man, we get it.
>>60940141
>say dumb shit
>hurrrrrr i've got no idea what i'm talking about
>you never did any tdd!
please anon
you're pathetic
if you've got no clue then say it instead of avoiding it with stupid shit
QUICK, WRITE A FUNCTION WHICH INTERSPERSES A LIST WITH A GIVEN VALUE
E.G.
intersperse("abcdefg", " ") => "a b c d e f g"
NOTICE THE VALUE ISN'T AFTER THE LAST ELEMENT
NO IMPORTING THE SOLUTION
>>60940170
that's a string constant, not a list.
>>60940170
>no importing the solution
damn
>>60940175
Not if the string is implemented using lists.
You can use arrays if you want.
>>60940170import intersperse as dpt
dpt.intersperse("abcdefg", " ")
>>60940170
Specification is unsafe in C due to lack of argument with the length of the char array, if it's not null terminated you'd be fucked
>>60940189
sasuga python
>>60940170def intersperse(string, sep):
return sep.join(string)
test
anybody ever read pic related? is there too much problem if this version uses Java 7?
Made a thing that draws voronoi diagrams using manhattan distance, and other weird distance metrics.
test
test
>>60940257
looks like shit
>>60940265
>java
Of course it does.
>>60940237
>only works on strings and atomic values
lmaoing @ ur code
>>60940260
Looks neat
>>60940284
It's pretty cool, I'm gonna try and see if I can do it based on pictures as input.
Also it feels good that I've made something substantial in C, as opposed to python. Finally I'm a real programmer.
>>60940265
>>60940273
I'm an absolute beginner and it's a free e-book, I read like 20 pages and so far it is OK
I guess I'll keep reading it besides the official tutorials
thx /g/entoomen
>>60937091
>Or is this just "UI on top of WebKit #13125"
The "torrent client" was actually "UI on top of LibTorrent #13125"...
>>60940283
It would definitely work on lists and might also on tuples and dicts.
>>60940211
a string constant is always null terminated
>>60940399
>might
>>60940211
Nobody uses C.
>>60940260
>that broken z buffer
is it running on psone or what?
>>60940260
Neat.
>>60940401
The function wouldn't just accept string constants, but any pointer
>>60940407
...he said, and millions of electronic engineers screamed in unison.
How to deal with relative paths? You can turn a relative path into an absolute path but what if you're calling searching for a file from a binary in /usr/local/bin and calling it from /some/other/dir? How would that work?
>>60940410
Some floating point artifacts or something, haven't really investigated what it is.
>>60940432
*segfaults*
>>60940404
Pretty sure you can call join on a tuple. If you iterate over a dict in python it will iterate over the keys so it might join all the keys.
>>60940436
How is this programming?
Ask on >>>/g/sqt/
>>60940436
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node214.html
Reading through these threads I honestly find it hard that anyone on here holds a job or much less a degree
>>60940170(defun intersperse (xs v &aux (car (car xs))
(cdr (cdr xs)))
(cond ((null cdr) xs)
(t (cons car (cons v (intersperse cdr v))))))
I feel there is a much better way of doing this.
>>60940519
Do you deny your nature?
>>60940531
Just use format. :^)
>>60940603
Please give me example.
>>60940613
Can you show the code please it's for school project
>>60940655
Wtf, are you the semantics fag.
Just wrote gentoofetch in C.
>>60940655
I was kidding. Most people don't like the usage of format since it's not lispy.
>>60940681
https://github.com/DmitryHetman/gentoofetch
Forgot link
>>60940691
>its not pythonic dude
>its not lispy dude
>its not rustacean, dude
>>60940721
I personally don't give a shit, but considering he wants it for a school project...
>>60940701
>that formatting
: |)
how do I tell that a number is a float in c++
foo(1);
how do I indicate that 1 is not an int or double but a float?
>>60940749
Duh just look at the type
>>60940749
1.f
1.0f
>>60940760
ah the point was the problem. java wins again in that regard
>>60940691
I still wanna see a format version.
>>60940662
Not me.
>>60940519
They don't. Most people here are hobbyist ""programmers"".
>>60940808
"Programmer" vs Programmer?
>>60940170
>NO IMPORTING
Fuck off then. I'm not going to re create IO
>>60940395
I didn't claim otherwise.
>>60940746
What formating?
>>60940971
That formatting
>>60937039
What is the right way to do OOP?
>inb4 smalltalk
>>60941023
scheme
>>60941067
Scheme isn't even OOP.
>>60941023
>small talk
what's the worth of this lang?
>>60941023
OCaml
>>60940981
Everything ok with it.
Code is very small.
>>60941023
Right way to do OOP is to do it in C.
Currently learning how to make games with Lua/Corona SDK. I made Pong (which was easy) and now I'm trying to make it "good" (which is hard).
I saw this vid on what you can do to make you game feel polished and I think it's great, you guys should check it out: https://www.youtube.com/watch?v=Fy0aCDmgnxg
I made a shitty Android game before with C#/Unity3D but I'm having much more fun with Corona.
>>60941080
All programming languages are shit.
>>60941103
>>60940681
>>60941080
OOP.
>>60941106
Such simple geme should be written in C.
>>60941106
If you want to talk game development vg has a thread about it.
>>>/vg/agdg/
>>60941137
What if he changes his name slightly?
@60941137
How do I unsubscribe to your blog?
@60941144
By sucking my cock
@60941176
You must be older than 18 to browse this website.
What do you think about Fuchsia /dpt/?
@60941258
This is why you need to fuck off to 9gag
>>60940418
Whoopty fucking do, it's called an API, in a language like C you simply state that the arguments have to be strings otherwise the behaviour is undefined, and that's it.
In C puts takes a const char * parameter, this could be a string or it could be a pointer into an array of [const] char, but if you pass the latter, you're going to have a bad day.
Uhm, /g/.
I think I have some problems with my homework.
One part, I seem to have a lack of knowledge on Java.
On the other hand... no, that's not a problem, I am capable of research.
But I don't seem to understand Java well..
https://pastebin.com/repUjMMN
This is the code so far.
Now what should I really try to look at in order to be able to solve this problem?
>>60941368
I don't understand the question.
>>60940701
>https://github.com/DmitryHetman/gentoofetch
You shouldn't be allowed to write C.
Ever...
>>60941392
I don't seem to understand Java well.
I was able to create a constructor and call the mixed color.
But when I wanted to implement some if-conditions inside the constructor to make sure that the values do not exceed or are below 255/0, it didn't really work to my satisfaction.
I just don't have any idea how Java works in general it seems and I came here, admitting defeat.
Now I want to know what I SHOULD be able to understand in order to implement the code for this java class.
>>60941263
>microkernel
It's shit.
>>60941263
Is it unix-like? If it is it should just go and die.
>>60941455
What went wrong with the if conditions?
Alright guys. I guess I got something interesting to work on. I want to create native Android playstore emulator + APK runner for GNU/Linux.
Since both the OSes use the same kernel it shouldn't be all that hard but I do think it's going to be somewhat difficult.
First thing's first, will google sue my ass if I make/distribute this program?
>>60941506
When I entered too low or too high numbers into the object's parameterlist in the public static void main body, pic related happened.
>>60941578
>Since both the OSes use the same kernel it shouldn't be all that hard but I do think it's going to be somewhat difficult.
You really think it's that simple? Good luck porting the entire android runtime lmao
>>60941607
ARchon
>>60941597
But in the same vein, if I enter valid numbers, it works.
But just the if conditions inside seem to be ignored wholly.
>>60941597
Move the first three lines (this.red = red etc.) to the end of the constructor, after the conditionals.
>>60939525
How do you pronounce this?
>>60941633
>POOshell
kek
>>60939638
>fn id<T>(t: T) -> T {
t
}
The fuck is the purpose of this
>>60941674
It's the polymorphic identity function.
Very useful for higher order functions.
>>60941694
>Very useful for higher order functions.
Oh, so it's useless.
>>60941640
It works.
Is this.red = red also locking the values or something?
Well, at least something I should research after I get back from the grocery shop
>>60941665
If it gets shit done, I am happy.
>>60941704
What?
>>60941704
Spotted the brainlet
>>60941724
I said,
Oh, so it's useless.
>>60941726
What?
I know you guys shit on OOP and Python, so forgive me for asking this:
I am learning the basics of OOP in Python and I am wondering what's going wrong. This minimal program works as intended: Each of the Beatle objects is destroyed when the main() function ends:#!/usr/bin/python
class Dude:
def __init__(self, name):
self.name = name
def getName(self):
return self.name
class Beatle(Dude):
def __init__(self, name, instr):
self.name = name
self.instr = instr
def __del__(self):
print "%s is ded." % self.name
def main():
Dude1 = Dude("Hans")
Dude2 = Dude("Franz")
Beatles = []
for (name, instr) in zip( ("John", "Paul", "George", "Ringo"), \
("Keys", "Bass", "Guitar", "Drums")):
Beatles.append(Beatle(name, instr))
return 0
if __name__ == "__main__":
main()
However, in this longer program (https://pastebin.com/y48Pa8py) I wrote prior to this stripped-down version, this is not the case. It seems that none of the Guy objects in the Guys list report their death, while a single Guy object does. What's going on?
>>60941725
>A function that returns it's input unchanged is useful.
How about just using the thing your passing in without the pointless function call?
Please, give me a (non trash, i.e. no haskell, retard diagrams. must be in a real language such as C++) example of how the """polymorphic identity function""" would be sufficiently useful, and what the trade off would be if it wasn't used.
>>60941715
The constructor and the object have different "red" variables.
Originally you copied the value of red from the constructor into the object, and then checked whether the value the constructor had was good. But you never changed the value that was already inside the object.
Now you copy into the object after checking.
>>60941758
Because HOFs are chained together you brainlet C tard
>>60941758
>a real language such as C++
>C++
Fuck off and kill yourself low IQ mongrel
>>60941758
C++ is not a language itself, it's C with different std libraries
>>60941782
>Low IQ retard calling someone else low IQ
lmao
>>60941791
I don't see this quote in his post. Where is it?
>>60941786
You're severely retarded if you actually think that.
>>60941791
C++ turdbrains are the lowest of the low, so everyone is automatically more intelligent than them,
Even Java is better than C++
>>60941803
It's true, C++ just adds two more standard libraries to C. C++ is not a language, it's a library pack
>/dpt/
>>60941803
C++ is a framework of C
>>60941810
Oh ok, so does that mean I can implementstd::vector<T>in C in the exact same way it's implemented in C++?
And why doesn't my C++ code that doesn't use the standard library not compile in my C compiler?
>>60941810
Is C++ just a library for C, or is it an overengineered extension of the core language that destroys its purity?
Come on Cfags you can't have both.
>>60941831
Of course, C++ is written in C
>>60941833
C++ to C is what Node.js is to JavaScript
>>60941834
Cool, then you can write it.
>>60941844
I don't write POO trash
>>60941758
I was about to show you an example but then I ran into a problem.
C++ doesn't have polymorphism.
>>60941856
Please do not mention that abomination called "C*+" again, this is a SFW board
>>60941856
What kind of polymorphism?
>>60941864
sorry
>>60941866
the good kind
>>60941834
So why doesn't this supposedly valid C code compile in my C compiler?
Afterall, there's no C++ standard library in use here.#include <stdio.h>
template <typename T>
static auto add(T a, T b) {
return a + b;
}
int main() {
printf("%i\n", add(5, 9));
return 0;
}
>>60941878
Because **+ is inconsistent
>>60941873
C++ has polymorphism, you're just a retard who can't use templates.
>>60941887
Who said anything about C++?
>>60941878 is C code, according to you.
Is C inconsistent?
>>60941878
>template <typename T>
V O M I T
O
M
I
T
>>60941878
>auto
>not T
>>60941878
>static auto add(T a, T b) {
> return a + b;
Brainlet sepples tard go poo in the loo
>>60941909
>Assuming T + T returns T
Why can't static and dynamic polymorphism be merged?
>>60941931
It is, in Rust.
>>60941909
T+T doesn't actually have to return T idiot.
>>60941942
Ooh, that's nice.
>>60941878
>there's no C++ standard library
That's why
Include your C++ std libraries
>>60941908
>struct foo f
V O M I T
O
M
I
T
>>60941931
>Can't
Why not?
>>60941954
Who are you quoting, brainlet?
>>60941954
Brain-damaged.
>>60941959
C programmers
>>60941931
>>60941947
Yes it does, you dumb CS retards. + should only be used for commutative group operations.
>>60941967
I don't see your quote posted anywhere ITT. Are you mentally disabled or did CPOOPOO damage your brain?
>>60941931
are you retarded? ever heard of interfaces or virtual functions?
>>60941968
Meant for >>60941929
>>60941954
>Brings up struct
Sepples pajeet get out
>>60941968
muh concatenation
>>60940701
>__attribute__((noreturn)) void main
kek. confirmed for retard,
>>60942001
>void main
Wew lads.
>>60941987
The difference between a pajeet C++ programming and a white C++ programmer, is the pajeet uses the class keyword peppers the class with getters/setters/useless shit, while the white man uses the struct keyword and keeps things simple, relying on the default constructor and braced initialization unless otherwise sufficiently needed.
>>60942015
>CPOOPOO
>White
Nice try Vishnu
>>60942015
this
C++ classes/structs exist only for RAII.
NEW THREAD NEW THREAD
>>60941758#include <functional>
template <typename A, typename B>
using fun = std::function<B(A)>;
template <typename A, typename B>
struct Either {
private:
bool state;
union {
A left;
B right;
} data;
public:
static Either<A,B> Left (A a) {
Either<A,B> result;
result.state = false;
result.data.left = a;
};
static Either<A,B> Right(B b) {
Either<A,B> result;
result.state = true;
result.data.right = b;
};
template <typename C>
C either(const fun<A,C>& f, const fun<B,C>& g) const {
return state ? g(data.right) : f(data.left);
};
};
template <typename T>
const fun<T,T> id = fun<T, T>([](T x){ return x; });
int main() {
const auto e = Either<int,float>::Left(0);
return e.either(id<int>, fun<float,int>([](float f) { return static_cast<int>(f); }));
}
>>60942042
Don't delude yourself it's going to be as shit
>>60942043
Posting C++ TRASH should be banned
New thread:
>>60942063
>>60942063
>>60942063
>>60942055
But people are more likely to fall for my bait if its the third and not the 300th
>>60942043
How to tell if a piece of C++ code is going to be trash:
>#include <functional>
>>60942088
How to tell if a piece of C++ code is going to be trash:
*
>>60942088
see >>60942093
I'm just doing what I was told.
>>60942088
>How to tell if a piece of C++ code is going to be trash:
It's a C++ code