« first day (3760 days earlier)      last day (1076 days later) » 
00:00 - 19:0019:00 - 00:00

7:04 PM
@lyxal Your setAttribute method doesn't look right
The type parameter Integer shadows the actual class java.lang.Integer, you don't need the cast (int) attr (although it's not wrong), and whoever gave you that assignment must be a very evil person to make you do all that casting
There are so many things that could go wrong there that you might as well just use a dynamically typed language
 
oh i didn't even notice the template had that, lol.
 
> template
Found the C++ programmer
But even without that, it makes my blood boil to see such blatant disregard for static typing
 
shhhh i misspoke (mistyped? ¯\_(ツ)_/¯)
 
What is the purpose of T if you're just going to cast it? Why not just use Object? Why does it print something instead of throwing an exception? How is a caller to know that they gave the method the wrong arguments? AHHHH!!!1
 
this is something i'd use unions for
does java have anything like that?
 
7:09 PM
No :(((
Even with unions, you wouldn't use integers to set attributes
 
This is truly cursed
 
like again that looks like something enums are supposed to be used for but idk how to code properly
 
Also the fact that all constructors first call the no-args constructor and then the fields get overwritten
Every time I look at that code I lose another firstful of hair
 
oh yeah wtf is up with that lmao
 
7:13 PM
CMP: Petition to burn Java to the ground and rebuild something beautiful from the ashes?
 
like each constructor calls the previous constructor and overwrites the relevant field like...
what would be appropriate btw? call constructors in the reverse order?
 
ngn
@user +1
 
@hyper-neutrino I think so, yeah
 
as in public Mammal(String pName, int pAge) calls this(pName, pAge, "default noise value");
 
Tbf I haven't written Java for a while, and even then, it was mostly maintaining code written by smarter people than I
 
7:15 PM
i don't hate java that much in reality (only ironically) but i still don't like it nearly as much as other languages i use lol
 
@hyper-neutrino That makes a lot more sense (and might be more concise)
 
at least it isn't public Mammal(Object... args) and then it checks the args length and sets the fields like that
 
@hyper-neutrino I hate the boilerplate and I hate how other people use it, but yeah, it's one of those things that people hate because other people hate it
(clarification: I also hate how I use Java, I always end up writing crappy code. Not discriminating here)
 
it's just really verbose. especially with frameworks it's kind of nice for larger / scalable projects but i'd still just rather use something else lol
half of the time i use java it's trivial stuff anyone could write, and the other half of the time i end up throwing together some weird hacky thing with three templates just to get one small thing to work
 
why type lot code when few code do trick?
5
 
7:16 PM
@hyper-neutrino public <T> Mammal(T... args) ;)
@cairdcoinheringaahing ye
 
@user ಠ_ಠ
 
@cairdcoinheringaahing That's the essence of CGCC in one statement
CMQ: (Serious this time) What do you think is the perfect balance between conciseness and readability? Which languages come closest to that balance?
 
ngn
@cairdcoinheringaahing it sounds better when reporting to your boss :)
 
@user Python's generally pretty golfy and pretty readable
It's not the best language, but it's got that going for it
 
+1 for python too; it has a lot of stuff I dislike about it but it's able to be golfy, it's pretty concise even without being unreasonable with golfing it, and it's quite readable
[x ** 2 for x in a] makes sense to me but it's also pretty concise
better than java.utils.Arrays.stream(a).map(x -> x * x).toArray(int[]::new) anyway
 
7:23 PM
lol
 
ngn
should have been a**2
 
array languages ftw
 
@hyper-neutrino That could be made slightly shorter, but yeah, Python's way better when it comes to that
 
what would be the most reasonable way to do an int[] to int[] conversion to square each element?
 
If you're doing math stuff on arrays, I'm assuming you have java.util.Arrays already imported, so you can do Arrays.stream(a).map(x -> x * x).toArray() (an IntStream doesn't need the int[]::new part)
 
7:24 PM
-1
Q: What is better, Python or React?

deveshruttalaWhat is better, Python or React? Can you please specify its use and some places to find much more info? Can we build a backend with React? Suggest me some places to learn them, are website and mobile apps and PC apps buildable by react or python? I would also appreciate that if you could give me ...

 
@user But that's really not a lot better
 
What not to ask on MM SO Anywhere on SE
 
wait how do you even compare a language to a framework
 
@user haskell, you can do terse function composition, or do more verbose stuff, but either way it's normally pretty nice
 
@user oh huh, TIL. so Arrays.stream will turn an int[] into an IntSream rather than a Stream<Integer>?
 
7:26 PM
@cairdcoinheringaahing I love how people find Stack Overflow, somehow navigate to MSE, make an account, draft a question, review it, and still post this kind of stuff
 
@rak1507 I want to disagree that haskell is readable
 
also i hate that List<int> is not allowed
 
@cairdcoinheringaahing have you seen much non golf haskell?
 
@cairdcoinheringaahing Some stuff gets pretty complex, but for simple stuff it's very nice
@hyper-neutrino I think so
@hyper-neutrino Soon, Valhalla will come. Soon...
 
@rak1507 No, but golfed code is generally the best way to test the balance between readable and concise
 
7:27 PM
I highly disagree
 
^
 
haskell has some amazing golf potential that makes it look completely disgusting
but regular haskell looks perfectly fine
 
Almost all my answers here use stuff I would never use in real code
@rak1507 As long as you have sane variable names and type annotations and not too much category theory magic
 
@rak1507 Yeah, but is it concise?
 
@cairdcoinheringaahing yes
 
7:28 PM
@cairdcoinheringaahing the second active question is also similar, lol
 
fac 0 = 1
fac x = x * (fac (x - 1))
 
reading is apparently too difficult
 
Take this foldl implementation:
 
concise, readable, elegant
 
@rak1507 I thought you were going to say Vyxal there :P
 
7:29 PM
lol
 
i know nearly nothing about haskell but being able to define it like f 0 = 1 and f x = x * f (x - 1) is one thing i know and really like
 
foldl f acc [] = acc
foldl f acc (h:t) = foldl f (f acc h) t
 
it's way nicer than f x = x ? x * f (x - 1) : 1 in any case (or however haskell does ternaries)
 
Yeah, I'll give you that. Haskell's pattern matching is a feature I wish Python had
 
you can do guards
fac n
| n == 0 = 1
| otherwise = n * fac (n-1)
imo it's not as nice
 
7:30 PM
That's less nice
 
i am once again going to complain about f = lambda x: ...
 
haha
 
I really like do notation too (never used it in Haskell, but Scala's for comprehensions are similar and I like the sugar)
 
ngn
@hyper-neutrino in python? what's wrong with it?
 
It's verbose and doesn't allow multi-line functions, I guess
 
7:32 PM
unfortunately (!) in proton is the not operator because prefix is prioritized over postfix
@ngn i think it's less readable than x => .... also more importantly it's less golfy
 
@user Lambdas kinda aren't supposed to allow multi line functions (or at least, multi statement)
 
^. the point in a lambda is a single expression from some parameters anyway :p
 
I guess, but it's kinda annoying. I'm used to writing multiline lambdas in Java and Scala
 
Then you should be writing functions instead :P
 
f = x => x! is better :P
 
7:34 PM
@cairdcoinheringaahing Then I'd end up with little functions named def idkwhattocallthis and def somelambdaaargument :P
 
just chain multiple expressions together like [[[a] and b] and c] and d
or i guess [a] and [b] and [c] and d is more readable
 
"readable"
 
fun fact: in proton, 3 & (+) & 5 returns a function that takes 0 arguments and returns 8, apparently :P
 
How do you return 8 values? Do you have a stack they get pushed onto?
 
It's returns the number 8
 
7:36 PM
i mean returns the number 8
 
Oh lol
 
(+) & 3 & 5 does as well (it's 5 + 3 not 3 + 5)
 
@hyper-neutrino Actually, if & means "partially compose", that makes sense
 
@cairdcoinheringaahing yeah, I'm not surprised that this works; it's what i'd expect anyway
and yes, & is partial compose
for whatever reason import random for (i : 1..10) print(random.random()) works but import random; for (i : 1..10) print(random.random()) doesn't
one of the most cursed things i allowed in proton was that if something can't be parsed in this expression it just becomes a new expression so import random f = random.random for (i : 1..10) print(f()) is allowed
it's good for golfing :P
 
There's a joke about subatomic particles to be made here, but I don't know where it is
 
ngn
7:49 PM
@user ah, so you only know its velocity? :)
 
8:09 PM
@ngn Um, I guess? I'm...not sure. There's some uncertainty here :P
 
ngn
yeah, in principle :)
 
8:34 PM
I feel excluded from this conversation
 
I guess you're just an observer here
 
ngn
9:00 PM
@Neil just puns on particle physics. the "uncertainty principle" says you can't know a particle's position ("where it is") and velocity at the same time.
 
@ngn yes, there's an exclusion principle as well
 
@ngn i feel like neil's making a joke about pauli's exclusion principle
 
@ngn I think he was making a pun on the pauli exclusion principle
 
(lol)
 
haha poor ngn 3 at once
 
9:02 PM
It's a superposition of chat messages :P
 
ngn
@Neil ha, i didn't get that one.. well done :)
 
@rak1507 Your message can't exist at the same time as hyper's :P
 
9:32 PM
0
A: Sandbox for Proposed Challenges

Etherytetags: code-golf sequence Based square-free words A square-free word is a word that contains no squares, i.e. contains no adjacent repeating subwords. For example, 0123 is square-free, while 0112 and 012123 are not (because 11 and 1212 are repetitions, respectively). In base-1 there is only one sq...

 
9:49 PM
@user not an assignment though. It's 100% an experiment by me - I wouldn't have given you the whole file otherwise. T is so I can pass any type to the set Attribute because it could be a string or integer or float. The type casting is because a) it required me to use non-primitive types (Java did) and b) switch no like Integer
 
Oh ok
btw, please don't take anything I said before personally - I thought a proper Java professor suggested that and didn't realize it was just an experiment
 
Bold of you to assume we've learned about generics
 
(also, does setAttribute work with <T> void setAttribute(Integer attr, T value) or void setAttribute(int attr, Object value)?)
@lyxal I know you're a Python person, I just didn't realize it was all your code
Btw if you want some extra cursedness, take a look at this :P
 
@user anything that allows set(1, "str") and set(2, 69.4) is good lol
 
I mean, does the switch work?
 
9:57 PM
Yes
What I shared actually works
 
Yay! You should have used set((int) 4.20, 69.0) from the start
@lyxal Can I see the code that blows up? It's for...research purposes
 
@user next time when I'm at my computer
There's a controller class and a child class of mammak
*mammal
 
10:20 PM
@user I didn't
General rule of thumb: if I ain't giving you the whole file and only snippets, it's probably an assignment
 
I'll keep that in mind
 
10:33 PM
CModeratelyLargeC: Bijection that turns an integer into a finite series of integers (or a finite series of integers into an integer)
Might not be possible but seems like it would be
Can probably restrict it to positive or nonnegative integers if that makes it easier
 
Does it have to be a strict bijection, or can we write a function that goes if (list of integers) {...} else {...}?
 
i'm a bit confused by the spec here; sounds like Cantor pairing func would just work but surely that's not what you meant?
 
@cairdcoinheringaahing Wait, I think I misremembered what a bijection is :/
 
@RedwolfPrograms I guess if it's an integer, you could turn it into a list of digits, and if it's a list of integers, you could turn each into a string, concatenate, and turn back into an integer?
 
ngn
10:48 PM
@user but that limits how large individual elements of the list can be
 
@ngn Right, I guess each has to be between 0 and 9
 
@RedwolfPrograms Convert ints to base 9 concat with 0s separating them. Reverse is break along 0s and convert each from base 9.
 
ngn
@RedwolfPrograms how about this: 100..010..010..0 (binary) - the number of zeroes in each stretch of zeroes encodes an item from the sequence
 
@WheatWizard Maybe bijective base 9?
 
In general if two things are both 1) infinite and 2) can be represented by strings, there is a bijection between them, doesn't matter their structure.
 
10:56 PM
A slightly more mathematical construction would be something like this: 1) establish bijection between N and N^n for any finite n (N^1, N^2, N^3, ...) 2) Map each integer list into a pair of integers (n, result of N^n->N) and then apply Cantor
 
ngn
number-theoretical solution: encode (x,y,z..) as a product of prime powers: 2^x 3^y 5^z ..
 
I like it
 
You have to fiddle with the zeros for that one a bit.
(otherwise (3 2 0) and (3 2) give the same integer.)
Oh wait you can just assume positive.
 
ngn
@WheatWizard but it must be a bijection :(
maybe incrementing the last item could work
 
Oh yeah, that's why you need to fiddle with them.
Yeah incrementing the last element should work.
 
ngn
11:06 PM
(x,y,...,z) <-> 2^x 3^y .. p^(z+1)
 
Now you have the problem of what maps to zero?
 
Offset the result by 2
 
ngn
(x,y,...,z) <-> 2^x 3^y .. p^(z+1) - 1 problem solved :)
 
(because the current one does not even map to 1)
wait.. empty list maps to 1?
Then -1, yes
 
Yeah I think that solves the problem now.
 
Makes sense now
Btw you can just do 69.420f, which is a float, and it'll usually be automatically boxed to a Float. Also, you don't need to explicitly give type arguments to setAttribute, since Java has (rather limited) type inference
Also, if you're using pounds, Joe and Not Joe seem to be dying of starvation
There's a joke to be made here, but I can't see it because of Joe Mama
 
Huh, the length limit for tag wiki excerpts is 460 characters. That's such an odd number to have as a limit :/
 
Any Feed Back?
 
It is known to be implemented in Dyalog APL, J, and NARS2000. You are not allowed to use floor/ceiling/residue/GCD/LCM functions with non-real complex arguments for these languages.
aww, no 1 byte answer
the other one looks impossible, 10/10
 
:)
 
11:44 PM
@RedwolfPrograms not sure if this is just on my end but it seems that GRT will keep opening new tabs so long as the review task is still there
just came back from dinner with like 10 tabs for the same thing open
not sure if there's a great way to prevent this
 
There's been nothing in the queues all day tho :/
 
Uninstall GRT, easy ;)
 
there was a reopen item earlier that i reviewed just now
 
11:47 PM
should have been there for at least like 10 or so minutes based on # tabs and when the reopen vote came in (can't give an exact time since idk if CV/VTRO is available on the public timeline)
@okie rather than editing out the profile some mods have started appending "spam" to the username and #spam to the URL so that other mods can detect them using the same patterns but can also just look for spam in the mod search
 
I've had GRT open for the last half hour, nothing ಠ_ಠ
 
@hyper-neutrino Why don't they simply remove the account, because they keep coming?
 
@okie mods on other sites can't delete users on our site
 
oh
 
@cairdcoinheringaahing maybe queues showing diff stuff to ppl or something? idrk. i think you mentioned something about that but i have no clue how anything to do with SE works ¯\_(ツ)_/¯
 
11:50 PM
that's big brain movement
 
it was hammer closed by WW (2 votes + mod) so IDK if it shows it to mods first or something. that could make sense but i also somewhat doubt it because moderators aren't exactly supposed to unilaterally do everything, the community has just as much of a hand in moderation as we do
 
NGL, the Redwolf + Caird + Diamond closing trio is weirdly common
 
i think redwolf finds an old thing, realizes it's unclear, you probably find it in the queue with RSR/GRT or through black magic (or vice versa), and then a mod notices it and hammers it
but yeah i see it a lot lol
 
Yes, black magic, yes
 
we may as well three-vote close on our site with how often this occurs /s
 
11:59 PM
I wonder if there's a way to get the users who closed a question from SEDE
Can't see anything here
 
i'd hope not since it's unlocked by reputation but like
 
00:00 - 19:0019:00 - 00:00

« first day (3760 days earlier)      last day (1076 days later) »