« first day (2173 days earlier)      last day (2655 days later) » 

7:00 PM
@El'endiaStarman that's a different issue IMO. This isn't a permissions issue at all, because I can still see the removed messages, I just have to click a button a gazillion times :P
@Pavel int array, with int output?
 
Yeah
 
that's getting really close the the average of a string
 
I remember seeing a really clever solution with Java 8 streams
 
oh wait
I didn't read the challenge correctly
nevermind
 
And nope, the solution to the challenge is the naïve approach.
Time to finally learn them Streams.
 
7:02 PM
streams are great
the biggest problem with them is the fact that you have to call .stream() and .collect()
everything else, I love
 
int mean(int[]a){
    return new java.util.ArrayList(java.util.Arrays.asList(a)).stream.mapToDouble(i->i).average();
}
That's actually far longer than I expected.
Is a java.util.ArrayList considered a valid IO format?
 
yeah
who's to say that int[] is more of an array than ArrayList<Integer>?
like, both of them come built into the language
 
int mean(java.util.ArrayList<Integer>a){
    return a.stream.mapToDouble(i->i).average();
}
Well, one of them requires an import.
Actually, we can do better with a lambda expression.
a->a.stream.mapToDouble(i->i).average()
Done
 
only if you want Geobits mad :P
 
You don't need the semicolon at the end, right?
And what does Geobits have against lambdas.
 
7:12 PM
many things
one ruined his childhood
he has sworn undying revenge
 
All I can say, is that that lambda is literally half the size of the non-lambda solution
 
@Pavel semicolons are required in Java
 
Yeah, but you can pass something a lambda expression as a parameter without the semicolon
 
the problem with lambdas is that declaring the type still has to be done somewhere
 
You can see it in the mapToDouble
 
7:13 PM
you can't just copy and paste that into a var a =
 
Again, look at the use of lambdas in mapToDouble
It's just a->a
 
it might be similar to my complaints here: meta.codegolf.stackexchange.com/questions/10974/…
 
@Pavel iirc thinks they count as snippets, not as full functions
 
technically its not against our rules, but that's Geobits' beef
 
because you have to add more boilerplate regarding types or something
 
7:14 PM
I would argue we don't have rules on it
there is no good consensus
 
The boilerplate is only there for testing.
 
we had this discussion last week
 
(I'm sure I agree with GeoBits)
 
yes
no cap b, just geobits/Geobits
 
You don't include f= in a python solution that looks like f=lambda ...
 
7:15 PM
Java != Python
 
Jython?
 
right, but that's because the lambda part is plug-n-play anywhere
 
It's just that Java's boilerplate is obscenely large.
 
the Java is not
 
(Disclaimer before I embarrass myself, I don't really know Java)
no, it's that Java is statically typed
 
7:16 PM
mapToDouble(i->i).
That uses a lambda expression.
No semicolon, no type declaration.
 
right, but the types are still there
the type declaration are in the mapToDouble function
 
Yes.
But you don't count that towards bytes.
 
the statement i->i has no meaning without those type definitions
or, to be more specific, it could mean an infinite of things depending on where you put it
but, by itself, its not valid code
and hence the problem with inferred typing
 
@NathanMerrill yes! some sense!
 
in python, however, lambda a: a always means the same thing
 
7:18 PM
lambda (a,b): a+b behaves differently depending on what you pass it, and fails outright if you pass it a string and an int.
You can assume that your code will be given valid input.
 
yes, but that behaviour is well defined
 
Same thing here. You can assume that your code will be used in a valid context.
 
as Nathan says, i->i has no meaning
 
@VisualMelon it doesn't have to be
 
@muddyfish how so? (I'm not a python user)
 
7:19 PM
if you were to do i, j -> i.add(j), what add function am I calling?
 
@NathanMerrill would you mind have a look over this ?
(it's me trying to get a consensus on this for C#)
would be interested to know just how similar the situation in Java is
 
I'm pretty sure its identical :P
 
@VisualMelon you could overload the add function to do something different each time or change the lambda itself
 
See, in C# you can just say something like in Python right? Just assign a lambda to a variable.
In java, there's no one good way.
 
@muddyfish but the definition is call the add method
 
7:21 PM
@Pavel dynamic typing and static typing are useful in different ways
 
@Pavel no, C# it all needs to be properly typed
 
@VisualMelon or the __iadd__ method
 
sorry, yeah, I don't know python (just following your example)
@Pavel the point is that the behaviour depends on the type at compile time, this concept doesn't exist in Python as far as I'm aware
 
@VisualMelon it doesn't
 
as such, the types have to known at compile time, and as such it's meaningless without them
 
7:23 PM
but in Java you can have reflection to achieve something interesting
 
@muddyfish would you mind clarifying that? I'm not sure if you are disagreeing or clarifying that Python doesn't have that feature ;)
 
public class Main {
    Interface lambda { int run(java.util.ArrayList<Integer> }
    public static void main(String[]a) {
         Lambda f=a->a.get(0);
         f.run(new ArrayList<Integer>());
    }
}
 
@VisualMelon I think the biggest problem with your post is mentioned in the beginning: its too long and feels like a rant :P
 
@VisualMelon python doesn't have the concept of types at compile time as far as I'm aware
 
Python doesn't have the concept of compile time.
 
7:24 PM
@NathanMerrill noted ;) the problem is that it's not a simple issue (or we wouldn't be arguing about it here for the 100th time), and don't want it sidetracked
@muddyfish thanks
 
the closest it gets to compile-type typing is type hinting
which is completely optional, and never throws an error
 
That's new in Python 3.5, right?
 
@VisualMelon actually, it does some stuff with types when doing compilation of functions and classes
 
not sure the version, but yeah, its pretty new
 
it creates code objects but those can change at runtime
(I'm not sure if this is specific to Cython only)
 
7:26 PM
tbqh I feel that the only things that should be allowed are things that can be copied/pasted into a new document, saved, and compiled / ran literally as-typed
 
@GabrielBenamy hear hear!
 
with the possible exception being unprintable characters
 
(no way we are getting that, but I think unambiguous code is an absolute must)
 
@GabrielBenamy just copy and paste with a hex editor :D
 
worst-case scenario would be "here are standard frameworks that you can assume your submission is enclosed in" which would be class declarations in Java, etc.
 
7:28 PM
that's what I've gone for in my original proposal for C#
my new proposal is that + some special stuff because the first proposal clearly hasn't convinced everybody
 
as in "here is some code. replace the '...' with your submission. if it runs as is, it works. if it fails, then your code is invalid."
 
@GabrielBenamy the best thing about writing a golflang is that you can choose the output format
 
0
A: Zero sum covers

ProgrammerJelly (18 bytes) : P<©^°∆h":+6l>>x%&;

This isn't Jelly code, is it?
 
nope
iirc the copyright isn't there either
@DJMcMayhem ..... why did you edit that?
 
@NathanMerrill is there something similar to (int a, int b) => a + b in java? (I've never gone above Java 1.7/7)
 
7:33 PM
@EᴀsᴛᴇʀʟʏIʀᴋ The copyright does exist in Jelly
 
@EᴀsᴛᴇʀʟʏIʀᴋ Because the formatting was wrong?
 
it's a NAA
it'll be nuked in a moment
 
@VisualMelon BiFunction<Integer, Integer, Integer> f = (a, b) -> a + b;
 
@Adnan yeah, if there was any doubt I tested and it borked
 
7:34 PM
so you can't specify the types in the lambda?
 
More generally, one of SE's standards is "don't edit crap".
 
oh, maybe you can
 
@Adnan Rather odd considering he appears to have OK posts on AI SE
 
OK, but there was no way to tell until I had already edited it
 
yeah, you can
 
7:35 PM
@El'endiaStarman I would have edited it to have the correct formatting because I don't know Jelly's codepage
 
(Integer a, Integer b) -> a + b; works
 
It also doesn't seem that bad. I'm giving them the benefit of the doubt
 
@quartata Huh, that is actually very weird
 
@NathanMerrill cracking, we can probably apply the exact same rules as C# then
 
I'm writing a meta post
that's a lot of flags
 
7:37 PM
WTF? It's not rude or abusive
At worst it's NAA
 
@NathanMerrill I know!
 
That's a lot of 'I'm not sure flags'
 
@DJMcMayhem Ehh, I did not flag it as spam or as offensive
 
Rude or abusive is for hate speech, not answers that sorta look invalid
 
7:38 PM
 
@Adnan Uhhh
 
Anyone ever gotten that?
 
@DJMcMayhem I disagree. That flag was mine. There's a post on Mother Meta somewhere that posting nonsense is rude. Lemme find it.
 
@Dennis If that wasn't NAA then I officially do not know what NAA is
We mark that kind of thing as NAA all the time in Charcoal HQ
 
A single post can deserve multiple flags. It's clearly NAA and VLQ, but that doesn't mean it's not rude.
 
7:40 PM
It doesn't look more nonsensical than most jelly code
 
49
A: Why don't we treat rubbish the same as spam?

Shog9 I'm assuming that's not what "abusive" in this reason is referring to Abusive means what it says. Don't overthink this. Look... The problem folks have with these is that they see the pile of nonsense and try to extract meaning from it. "Surely if I can determine what the author's intent was...

 
I think he was either trying to make a joke or legitimately didn't get that jelly wasn't just made up symbols randomly thrown together
 
I don't care what the intention was. Keyboard mashing is keyboard mashing.
 
tbf that's really impressive keyboard mashing then
> ... It contains only gibberish, such as “fsdguejgkfdlk”. Use the rude or abusive flag for these cases, or flag for moderator attention with a custom explanation if it requires more detail.
that is from here, "what is spam"
 
That wasn't keyboard mashing. Ignoring whether it was valid code or not (which most people in here can't tell with jelly anyway) it was coherent and looks like an answer.
Albeit a poorly formatted one
 
7:43 PM
it was gibberish
the question is "did it work"
the answer is no
 
Then it's NAA
 
normal jelly is still gibberish, just functioning gibberish
@DJMcMayhem or VLQ
 
> This includes posts that contain no useful content at all
It had a little bit of content
 
3
Q: Spam-Flag Wave seemed to crash chat

Kaz WolfeAt about 19:35 PM UTC on January 10, 2017, a very large number of chat flags were sent from the Russian StackOverflow chatroom to every 10k user on the network. Shortly afterwards, chat began to lag very severely, finally crashing altogether around 19:40 PM. As of 19:42 PM, the chat appears to...

 
I don't really think you can rightfully call functional Jelly "gibberish". That'd be like calling Russian gibberish (as an English speaker that has no experience with the language).
 
7:45 PM
anybody else have that?
it completely borked chrome for me, because I had 2 chatroom tabs open
 
Yup, me too.
 
If a Python submission had a typo would that make it gibberish?
 
Well, my chat tabs stayed up, but I couldn't really do anything.
 
mine just crashed
 
@EᴀsᴛᴇʀʟʏIʀᴋ It gave me several error messages and it still says 0 in a blue circle by my avatar
 
7:46 PM
@DJMcMayhem 1 typo does not gibberish make
@muddyfish o_O
 
@DJMcMayhem the interpreter might think so
 
@DJMcMayhem It was keyboard meshing surrounded by bits and pieces to make it look like a valid answer. That's worse, not better. The sole purpose of this "answer" was to waste people's time. Looking at the transcript, I'd say mission accomplished.
5
 
@DJMcMayhem I'd say "no" because for a Python submission to have one typo, that would mean it had to have been written mostly properly. I don't know Jelly, but Dennis does, so I believe him when he says it was keyboard mashing.
 
So how long until someone makes a bot that raises a load of flags to kill chat?
 
7:49 PM
please help me i am crying
 
@muddyfish 3 hours give or take a bit
@GabrielBenamy did you try onions they help
 
@EᴀsᴛᴇʀʟʏIʀᴋ Took my tabs down for about a minute or so
I think I was in on the tail end though
 
lucky, lot more for me
 
@GabrielBenamy lol
 
The zero's gone now
I wonder why it went then
 
7:52 PM
You're not longer a zero, now you're a hero \o/
 
congratulations
you managed to kill that boss, you see
the grinning colossus
you're the hero we all wish we could be
you made it through the tunnel
then you grabbed that fire on the wall
you jumped up above him
then you burned the rope and saved us all
you burned the rope and saved us all
you burned the rope and saved us...
now you're a hero, you've managed to beat the whole damn game
we're happy you made it, but how are you gonna spend the rest of this day?
maybe watch a video
maybe press refresh and start again
 
What's that from?
 
ending credits to "you have to burn the rope"
 
@Dennis OK, thanks for clearing it up. Sorry for jumping on you like that
 
8:07 PM
Would anyone that knows a bit about abstract algebra like help me out with a challenge I am writing?
 
0
Q: Untyped functions in static langauges

Nathan MerrillI'll be using Java in this post, but the following also applies to C#, and likely other languages. We require that submissions must be a first-class function, or a full program to be valid. In Java, many users have started using untyped lambdas as their submission. The problem with untyped lam...

 
@WheatWizard sure, what's going on?
 
@GabrielBenamy Ok so I am under the impression that the concept of XOR primes has something to do with rings. And I was hoping to write a challenge involving XOR primes in base -2 as opposed to base 2. But I was struggling to prove that such primes could exist let alone that a particular number might be prime.
 
@NathanMerrill What would your proposal mean for Haskell? AFAIK the consensus has always been to omit type signatures unless the code won't compile without them, since it almost always does.
 
I don't know haskell, but can you do something similar to (a,b) -> a.someFunc(b)?
 
8:15 PM
I was hoping to prove a version of the fundamental theorem of arithmetic with base -2 XOR multiplication but I am hitting a wall and was hoping that abstract algebra might be able to help me, but I don't really know where to start
 
You can do \a b->a+b, which works for any a and b that are part of the same numeric typeclass.
 
right, but + already has some implications for the types you are using
I'm specifically asking about a function that doesn't carry any implications like that
 
So does a.someFunc
 
Oh I see, Java doesn't check that someFunc exists anywhere in the scope.
 
If you think of a+b as a.operator+(b) I don't see the difference
 
8:18 PM
@quartata no, it doesn't. You have no idea where someFunc comes from
 
All you know is the type has something named that.
 
but then all I need to do is find a library with the shortest someFunc(), and use it
 
In Haskell, + is part of the Num typeclass (which is kind of like a Java interface), which is avaliable without imports. So you know a and b have a type that's an instance of Num.
 
its basically my list -> list.sortThis() problem
 
I'm talking from the perspective of C++ where operator overloading is not a trait.
I believe C# and Swift work the same.
 
8:22 PM
operators (including overloading) aren't where the problem lies (IMO)
its calling an unknown function on an unknown type
 
If the problem lies in your example it also lies in operators.
 
>> combinations(1933, 567)
inf
gee thanks
 
Having an operator makes no implications of its type in several languages
 
@quartata right, but in most cases, operators generally carry a sense of "numericness"
 
Not in C++.
 
8:23 PM
Can I ask a geometry terminology question? What is the opposite of inscribing? Like, rather than finding the largest shape b that fits inside of another shape a, I want to find the smallest shape a that shape b fits inside of
 
I know that that isn't always the case (which is why I don't make a difference between the two in my answer)
 
all you need is the right member method
 
@DJMcMayhem circumscribing
 
but its why I don't present the problem from an operator standpoint
 
8:24 PM
The only difference is name
 
@Adnan I can't view the full thing though :(
due to stupid freakin domain blocks
 
@GabrielBenamy ah, perfect. Thanks!
 
@quartata right, I get that, but in the interest of clarity, its much easier to talk about named functions (due to the huge amout of variety with how languages deal with operators)
 
idk why but it errors when I click "more digits"
 
@EᴀsᴛᴇʀʟʏIʀᴋ okay, let me pastebin it
 
8:26 PM
@NathanMerrill I guess my point is that it's almost impossible to generalize this
 
what do you mean?
 
So maybe do it on a language by language basis
Haskell Go and Swift all fit under the static banner but work completely differently from what you describe
Perhaps specify manifest instead if you want to keep it general. more accurate
 
@NathanMerrill thanks for the new post (nice and short!) - in my second answer I discuss the explicit nature of the type-inferred return type from lambdas: can a similar thing be done in Java? (asking the return value what type it is wouldn't count)
 
@NathanMerrill I remember there being a Meta post about exactly this for Python, but I can't seem to find it now...
 
ok, in each of those languages: lets say you have a lambda that passes a variable, and return the value of someFunc
what does that look like @quartata (if you don't mind)
 
8:29 PM
@Adnan thanks!
that worked
 
11
Q: Should function literals be allowed when a function is asked for?

nyuszika7hI'm arguing with the poster of this answer. The function literal as is doesn't cause the function to be defined, it has to be assigned to a variable, giving it a name or wrapping it like (function(n){...}(1)). Here is the function literal in question: function(n){for(var c=Math.pow(10,(''+Math....

 
0
Q: Is it an OVSF code?

LynnGiven a list of 1s and -1s, determine whether or not it is a valid OVSF code. OVSF codes are defined as follows: [1] is an OVSF code. If X is an OVSF code, then X ++ X and X ++ -X are both OVSF codes. Here ++ is list concatenation, and - negates every element in the list. No other lists are v...

 
@VisualMelon return types are different because they can be inferred from the input types.
 
Zgarb already showed the Haskell one
 
@NathanMerrill indeed, but is there a way to verify what type the Java compiler thinks it? (like the var trick in C#)?
 
8:30 PM
@quartata that was for +. Can we stick to named functions, because that's easier for me to understand?
 
or perhaps java just doesn't allow the same implicit casting as C# in this instance
 
@NathanMerrill In Haskell, if someFunc is not in scope (as a concrete implementation or typeclass member), it won't compile.
 
@VisualMelon I mean, no? All of those types are compiled away
 
so is there no systematic way that a PPCG user can determine the return type of a lambda?
 
@Zgarb but if you are passed a SomeClass, which has a concrete implementation of someFunc, it will compile without you ever saying "SomeClass" or importing the function?
@VisualMelon I mean, the compiler does it somehow. it has to
but as for a snippet that does it, that'd be tough to write
 
8:33 PM
well, for C# I suggest injecting code
 
@EᴀsᴛᴇʀʟʏIʀᴋ To be fair, if you're trying to do 1933 nCr 567, that's a really big number.
 
at which point VS or w/e will politely tell you everything you want to know
 
@NathanMerrill Haskell has no classes. The only form of ad hoc polymorphism are typeclasses, which you have to import.
 
and, if you are passed a typeclass you still need to import it?
 
Yes, if you use its functionality.
Like by applying someFunction
 
8:35 PM
But the types don't have to be specified necessarily
There aren't any real methods in the sense you are thinking of which is why it doesn't translate
 
what happens if there are type typeclasses both with someFunction?
oh, you don't call methods on objects?
 
@quartata which language is this, and is it statically typed?
 
its basically a bunch of a functions
 
Haskell. And yes.
 
which makes sense because its a functional language :P
ignore my above question then
 
8:37 PM
That's why it can be inferred, because it's more like overloading a function as opposed to different methods spread across namespaces
I don't know a whole lot about Go but Go does not use nominative typing for the most part
Meaning that all that really has to be known is if these types have the same members and stuff not what they are
 
yeah, its a different kettle of fish
 
Hell interfaces are anonymous
 
@Poke No, that's different. I remember a post about whether you can use the methods of NumPy arrays without importing NumPy, if you assume one is passed to your function. It may not have been NumPy, but something like that.
 
so, maybe change my post to "Require type definitions if member methods are used"?
 
@quartata in Go? Go's types are very strict
You might be thinking of interfaces
 
8:40 PM
Did I say they weren't?
 
@NathanMerrill That Python question may be of interest to you too.
 
does that sound more bullet proof @quartata ?
 
@NathanMerrill I'd say it would be wrong then, we're mixing concepts between languages
Haskell is a completely different beast to C# or Java
 
@NathanMerrill No change it to require type definitions in languages with manifest typing disciplines
 
"with manifest typing disciplines" means nothing to me
 
8:41 PM
@quartata I guess I'm misreading but it really looks like that to me :S
 
@Zgarb I read over it, but I'm not sure what exactly you are referring to
 
@NathanMerrill I mean the one I'm having trouble finding. :P
 
@NathanMerrill Types cannot be fully inferred. You have to annotate them (hence manifest)
 
@quartata nvm I needed to know what "nominative typing" meant
 
Googles "manifest typing"
 
8:44 PM
Bings "nominative typing"
 
nominal typing might be more what we are looking for
 
@quartata but in my example Java is able to fully infer the types of the functions
 
but honestly, if we don't understand these words, who else is going to?
 
Haskell Go and Swift all have inferred typing disciplines.
@NathanMerrill Not without a cast actually.
 
Python has dynamic typing, C-like have static typing, what is this nominative typing.
 
8:45 PM
@quartata what it does behind the scenes is irrelevant
 
@Pavel C is static weak nominative manifest
 
I could make my own version of Java that doesn't cast, and it would still be a problem
 
@NathanMerrill if the user has to cast it explicitly that is manifest
before calling
 
oh, I don't have to explicity cast
 
before calling you will
 
8:46 PM
Yeah you do. If you're assigning or calling. C# too.
 
@quartata I take it nominative typing is the same as nominal typing ?
 
C++ is a litle murkier due to auto but it wouldn't take this either
@VisualMelon Yes it says right there :P
 
like, if I have a List<BigInteger>, I can call list.stream().map(a -> a.add(4))
 
@quartata ... thanks ;)
 
when I call add, I don't need any cast for it to work
for assigning, sure
but calls don't need types
 
8:49 PM
Because your generic provides the type. No inference happening there
 
(I think quartata and I were referring to calling the lambda)
 
what's "inference" then?
 
Sure there are gray areas but most people agree Java is strictly manifest whie Haskell and co are not
@NathanMerrill The compiler deduces the type completely
 
is binary inversion of n the right phrase for n with all the bits toggled?
 
7
Q: Scoring Java lambdas with imports

CAD97In this answer, I used a java.util.List as a parameter to an anonymous function (lambda) answer. So, my question is, Should this import be counted to the byte total? I know, it feels like the obvious answer should be YES - if you don't import java.util.*, my example usage won't compile. Howeve...

 
8:50 PM
@FlipTack I think so. It gets the idea across to me anyways
 
There. Was Java, not Python.
 
Is there just a list of typing disciplines I can look through?
 
@quartata and if this becomes a thing?
(aka, adding var as your type to variabes)?
 
@Pavel: A typing discipline has several components: when the lanfuage enforces types, what the language does upon a mismatch, how a lanfuage determines whether types are equivalent and how types are determined
 
@Pavel en.wikipedia.org/wiki/Type_system is probably as good as any
 
8:53 PM
The first is static vs dynamic: compile or runtime
 
The second is strong vs weak: an error or implicit coercion
 
(I disagree with most assertions thereabout)
(I would ignore that hands down)
 
There's more options for the other two but what you're most familiar with is nominative, i.e comparison based on the names of types, and manifest, types are provided by the programmer
Other options for the third are structural (Go) or duck (Python)
 
0
Q: 7 day chat suspension

watWhy have I received a 7 day chat suspension? I do not recall doing anything harmful or bad for the chatroom, except maybe posting faces, but I don't see how that warrants a 7 day ban.

 
8:56 PM
Structural means that types are equivalent if they both have the exact same members and methods and what not
 
so almost as bad a duck typing... I'll steer clear of Go then
 
Duck is simiar but only based on the current method or member in the context
 
indeed
 
@NewMetaPosts are you serious
calls mods nazis right to their face and asks why they got a suspension
 
I love Golang's type system
 
8:58 PM
@quartata smh
 
@ViualMelon Structural is not as bad as it sounds
 

« first day (2173 days earlier)      last day (2655 days later) »