« first day (2151 days earlier)      last day (2693 days later) » 

7:01 PM
But surely your parents are concerned too. This isn't just internet censorship
 
7:23 PM
i love javascript. undefined == null is true, undefined === null is false. NaN == NaN is also false.
 
Don't bother comparing to null. Just if (myVar) {} and avoid the whole situation
 
@Rainbolt I'm not doing anything like that, I'm just laughing at how absurd the whole thing is.
 
My favorite:
> "\t" == 0
< true
 
It took me over a year to realize that if I declare something without var, it continues up the stack until it finds a variable with the name. Once it reaches global, if it still hasn't found a variable with that name, it just declares it there (in global).
 
7:27 PM
what
@Dennis ?????????????????????????????????????
@Dennis "\n" == 0 is also true
as are \r and ` ` (empty space)
 
Yes, it works with any combination of whitespace characters.
 
who... who designed this...
 
Keep in mind that Dennis is demonstrating how to use the wrong operator, so of course it will do silly things
Use === to get the behavior you expect
 
All JavaScript operators are the wrong operator.
3
 
Oh no, I better write some bugs then. I'm using the wrong operator everywhere!
 
7:33 PM
And of course, there's the lack of transitivity.
> "\t\r\n \v\f" == 0
< true
> 0 == "0"
< true
> "\t\r\n \v\f" == "0"
< false
 
i'm crying
 
Of course, JavaScript isn't alone in its madness. tio.run/nexus/…
 
0
Q: Help the Help Center

nedla2004When I read through the help center recently, I was surprised how little some of the pages were related to this site, one example being How to not be a spammer, which looks like it comes from Stack Overflow with only the site name changed. Is it possible to change big parts of the help center, as...

0
Q: Do we not need [knot-theory]?

mbomb007A recent challenge (A Rather Knotty Conundrum) added the knot-theory tag. No previous knot theory challenges use this tag yet. Before I consider using the tag, I want to see if the tag is really necessary. This tag might make sense on Math.SE, but it seems pretty specific for our use on PPCG, and...

 
@Dennis Not sure if that's better or worse.
 
7:49 PM
cause of death: @Dennis
 
Sure, blame me, not the people who made those insane design decisions. :P
 
Why are whitespace strings falsey?
That's horrible.
<some giant Whitespace program> == 0
Hehe, I made my avatar big enough that it covers up my name.
 
Oh, they're not falsy. They're just equal to false.
> "\t\r\n \v\f" == false
< true
> if ("\t\r\n \v\f") console.log("truthy")
  truthy
 
twitch
 
Because that totally makes sense.
 
7:57 PM
How does the Internet not fall apart with such a language as one of its main components?!
 
I love these hats. I can make such weird things with my Kirby avatar!
 
No clue. The mind-boggling inconsistencies between implementations makes it even worse. The same CSS animation has four different behaviors in Chrome, Firefox, Edge, and IE 11. And I can't even tell which one got it right. None of them makes any sense.
 
I give thee, Kirby wearing a black dress with a wildly fantastic hair-doo
 
@mbomb007 Kirby has gone super-saiyan?
 
:D
I've changed my avatar 4 or 5 times today, I should take a screenshot to keep it.
It's worth it.
 
8:03 PM
@Dennis That's ... wow.
 
@Dennis Why must you desecrate my corpse like this? I'm already dead, and yet you continue
 
@GabrielBenamy Oh, PowerShell is better (in some ways). An empty script block is truthy, but an executed empty script block is falsey.
PS C:\Tools\Scripts\golfing> if(&{}){"true"}

PS C:\Tools\Scripts\golfing> if({}){"true"}
true
 
@TimmyD what happens if you try to execute the output from the falsy version
 
user image
9
It looked good right-side-up, but I couldn't resist using the mustache as eyebrows.
 
@GabrielBenamy Executing empty results in nothing
 
8:09 PM
@Downgoat do you have much experience with the HTML canvas?
 
@Dennis O_O what happened to your face?
 
@GabrielBenamy if you wanted an explanation, since there is a numeric argument, == tries to cast both of its arguments to numbers. Leading whitespace in a number cast is treated as a no op, and so the cast returns the default value, 0. So, the statement is equivalent to +' ' == +0, or 0 == 0. It's perhaps unusual, yes, but not insane. There is a method to the madness.
 
@ConorO'Brien " a" == " b" yields false for me
 
@GabrielBenamy right, because neither of the operands are numbers.
 
Empty arrays in PowerShell are falsey. However, empty hashtables are truthy.
 
8:20 PM
0
Q: Number of prime knots with n crossings

mbomb007A prime knot is: a non-trivial knot which cannot be written as the knot sum of two non-trivial knots. Here are all prime knots with 7 or fewer crossings (the Unknot is not prime): You need to output the number of unique prime knots for a given number of crossings. 1 0 2 0 3 1 4 ...

 
@ConorO'Brien Did you see my question?
 
@quartata eh? which question?
 
Check your pings :P
 
oh the one with the local scope thingy
 
Can't link it on mobile but basically
When I say locals I don't mean let or anything
 
8:33 PM
then what do you mean?
 
just variables in the function scope
That's local in ES5
When you define something outside a function it goes in window hence why I suspect there's an equivalent
 
there is no equivalent to window
 
That's block scope
try (function() { ... })()
 
so basically you want this to work:
(function(){ var k = 3; console.log(locals.k) })(); window.k
 
Yes
 
8:40 PM
@ConorO'Brien unfortunately yes
 
?
 
@quartata you mean like this?
 
I want the equivalent of locals() in Python
 
I dunno what that does
 
I want every variable defined in this function/namespace
 
8:43 PM
I just explained to my boss (a programmer) the concept of truthiness
 
Failing that how can I force a variable to be global? I could save a copy of window and take the difference
 
@GabrielBenamy Did you use JavaScript?
 
which would be slow as molasses but usable as a fallback
In case this is an XY problem I'm trying to transpile generators. My plan was to place labels at each yield, save the variables then reinstantiate them and jump to the appropriate label when called again
I'd rather use a web worker but they may not be available
@Downgoat @ConorO'Brien
 
@Downgoat how do I scale a range? e.g. take the imagedata from (x1 y1) to (x2 y2) and make it larger?
 
@TimmyD My boss thinks JS is wizardry. I showed him using PHP (the language he writes most of his code in)
 
8:50 PM
Well, from what I've just seen in this chat, JS is wizardry.
As in, it requires a wizard with a Scroll of Comprehend Language to be able to understand it.
 
@TimmyD That's mostly because I'm trying to fit a Pytek shaped peg in a JS shaped hole
 
I explained to my boss the concept of the null coalescing operator, which is ?? in PHP 7
and how it saves you from a ton of unnecessary if isset / elseif isset / else statements
and how you can chain ?? operators to each other. "Wait, that works?" "Yeah, because of this is true, it short-circuits and evaluates it, otherwise it tries the next one, and if that's true it short-circuits and evaluates, otherwise it tries the next one"
"Anything that evaluates to something tangible is true, otherwise it's false" "yeah but it's not the same as false, right?" [codes up a direct example] "wow, I didn't know that"
 
(I've snapped my long meta post into Question and Answer for those who might be interested)
 
With credit sometimes you just don't learn things about programming until well after you're a professional, even basic concepts.
 
@quartata See, if I ever get around to finishing my sandbox entry, then you'll immediately be able to tell these things without straining yourself. ;-)
 
8:58 PM
i find the best programmers were never hand held by tutorials
 
lolol ... On an email chain at work, we're discussing a particular technical point regarding email domain names. Here's the funny snippet:
> Before his future was freed up, a former fellow employee unwittingly ran a script that changed virtually everybody’s email address.
 
The dev team at my work uses Unicode and UTF-8 interchangeably
 
1
Q: Find largest product of longest subsequence between min and max

KgOfHedgehogsTask: Input: A non-empty sequence of integers greater than zero, the length of which is greater than 1. Output: The product of all elements of the longest subsequence between the minimum and maximum elements of sequence including themselves. Note: Because the minimum and maximum elements ca...

 
@GabrielBenamy TIL, but on the other hand I don't remember when I used PHP the last time
 
but they seem to have no idea that ASCIIis in the UTF-8 encoding
 
9:01 PM
@ATaco I don't think you understand the difference between Unicode and utf-8
Utf-8 just maps byte sequences to Unicode code points
 
>please remove any Unicode from filenames
 
In other words, utf-8 is an implementation of Unicode
 
@quartata as in, JS generators?
 
utf-8 is one of many encodings that support Unicode, which itself is a 16bit encoding that encode almost every character, including emoji
if you remove Unicode from a file name, which is stored in 1252 anyway, would be to remove the file name
implicitly stored in 1252, I should say
 
@ConorO'Brien ?
 
9:06 PM
@quartata Object.keys
 
Unicode isn't an encoding though
 
what
 
Exactly
 
Oh I wasn't referring to you @DJMcMayhem
 
Wait, I did say encoding there, didn't i?
 
9:07 PM
woops
 
regardless, UTF8!=Unicode
 
@Downgoat ELI5?
 
@quartata you are talking about transpiling generators, no?
 
@quartata can you give example
 
@ConorO'Brien yes
 
9:08 PM
is the source in JS?
as in, are the generators you are trying to transpile written in JS
 
It's usually a bad idea to expose locals to a different scope, are you sure this isn't the XY problem?
 
@ConorO'Brien no
@ATaco That's not what I'm doing
@Downgoat let me type up a sample
 
All good then
 
@quartata wat
Object.keys is ES5 if that's what you mean
 
One shouldn't always be warey of the XY problem.
 
9:13 PM
oh
 
@quartata then what are you doing
 
Also, does the SE app have chat support?
 
Object.keys(this) gets you list of local variables
 
(int gen func):generator() {
  \for[i]([0..10)) {
    \yield(i);
  }
}
Turn that into
 
into what?
 
9:21 PM
var generators = [null];

function generator() {
  return {
    ...
    next: function() {
      if (generators[0]) {
        locals = generators[0].state;
        switch (generators[0].pos) {
          case 0:
            goto YIELD_0;
        }
    }
    for (var i = 0; i < 10; i++) {
      generators[0].state = locals;
      generators[0].pos = 0;
      return i;
      YIELD_0:
    }
  }
}
stupid markdown
here I'll type up a cleaner one
writing code on phones is hard
I hope you get the gist. Kind of like a duff device in terms of the loop trick
 
@ConorO'Brien I made functional babel plugin :D
 
nice!
 
So what's the verdict doc
 
@quartata you know that JS has generators right
 
I can try to do compile time reasoning on what's in scope but
@ConorO'Brien ES6.
or es7 can't remember
Is there a mod that can fix the code block?
 
9:28 PM
@quartata Fixed it for you.
 
Beautiful thank you
 
The issue was a single empty line that didn't have four spaces.
 
yikes my indentation is wrong
oh well
@Downgoat Take another look?
 
me: admits in the comments that I'm pretty sure my code doesn't give the number I claim it does
me: gets 8 upvotes anyway
 
Hahaha, this answer is amazing
2
A: In what spot would the new Star Wars Movie "Rogue One" go in the Machete Order?

Ben MillerRod Hilton, the originator of Machete Order, answered this very question in his follow-up post to Machete Order. He includes a helpful diagram as his answer to this and future questions like it: Where Does Rogue One fit? "Since Rogue One is basically a prequel to IV, should Machete Orde...

 
9:32 PM
@quartata right but you can transpile it down from es6
 
@ConorO'Brien I would rather not have people have to run Babel when I could do it one step. Also ES6 generators aren't good enough for my purpose
 
@quartata oh I see
solution is to use babel
 
did you not read what I just said
 
... I don't think you understand what babel is
 
Have you tried jQuery?
 
9:34 PM
it's not like typescript or the other thing
It's just a JS code transform tool
people just use it for ES6 -> ES5
 
I am aware of that.
 
use babylon (babel-types? idk) to generate your AST and it'll let you handle all the scoping stuff without super-slow reflection and runtime tasks
 
But peope are going to have to run pytek first anyways
Also this is a fallback
And it shouldn't be that slow
 
JQuery is good and does all things.
 
@DJMcMayhem Haha, nice.
 
9:36 PM
Not sure what problem is but OK.
 
?
 
Does anyone here know an opensource online-proxy-thing?
 
@quartata babel is hardly slow
 
function* asdf(){

}
 
Also you mentioned Object.keys how does that work
 
9:38 PM
"use strict";

var _marked = [asdf].map(regeneratorRuntime.mark);

function asdf() {
  return regeneratorRuntime.wrap(function asdf$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
        case "end":
          return _context.stop();
      }
    }
  }, _marked[0], this);
}
 
@quartata see my example anove
 
@Downgoat I didn't say Babel was slow at all. I said that the emitted code should not be that slow
I was under the impression that this was equivalent to window except in an object
Although this is in an object... hrmmm
 
This I believe just refers to the object in scope, which by default is window
 
Why not write pytek in nodejs and do a webpack
 
kek
Do you know a good microbenchmarking tool for JS?
 
9:43 PM
No
 
Bummer.
 
Don't do micropptimizations in JS please
bad idea
Probably will make your code even slower
 
Not what I'm doing
Just want to see if I should even bother with the web worker way
 
Actually wait yes
are you faimilar woth C++?
you can use v8s profiler
 
Link?
If I'm just embedding in C++ though might as well use Google Benchmark
Will it have Web Workers?
 
9:46 PM
Probably
 
Wait, JS doesn't have goto.
Could have warned me >_>
Well crap. What browsers support Web Workers nowadays?
 
@quartata kinda sorta has
@quartata support is pretty good
 
I need pretty precise behavior goto-wise
 
Like if it doesn't translate exactly into a jump it's useless
 
9:51 PM
goto Google and pick a better langauge
 
@quartata I mean there is continue but you're approaching it wrong if you're thinking goto
just do what babel do
 
Do you get why I need the goto?
I know of no other language construct that does that.
 
I'm not talking about GOTO I'm saying there is dlaw in solution to problem
 
Chrome 49+, IE11+? rip
This was so easy in C. What the heck.
 
9:55 PM
Lets be fair, no one care about IE users
 
I do.
And up until a couple months ago I was using Chrome 44.
 
Chrome support since beginning
 
I draw the line at recent past self can't use
@Downgoat Not according to it.
 
youre not looking at it correctly
hit show all button
 
Oh gotcha.
 
9:57 PM
Also its IE 10+
 
OK that's pretty good support.
I'll roll with it.
 
@Downgoat I care about IE users because I'm one of 'em.
 
:O blasphem !
 
Careful, the angry yeti thing in my avatar will rip your arms off :p
Wow, that was a heck of a typo.
 
@TimmyD same
only on occasion tho
 
10:00 PM
I dont see anything besides logo of not sh
 
@Downgoat Hat?
 
No hat i see
 
@Downgoat Either you a) hate hats or b) need to refresh the page.
 
c) I'm on mobile
 
or c) they don't render on mobile
seriously
 
10:02 PM
Oh. Welp.
 
That was quite the ninja
Mad respect
 
@TimmyD Haha I don't have arms >:)
 
'night
 
@TuxCopter Question: are you antartic penguin
 
there are penguins in Australia
 
10:11 PM
To hat or not to hat, that is the question.
hmm
 
1
Q: Big numbers: Ultrafactorials

devRicherUltrafactorials The ultrafactorials are a sequence of numbers which can be simplified with the following function: a(n) = n! ^ n! The resulting values rise extremely exponentially. Side note: This is entry A046882 in the OEIS. Also related are the hyperfactorials, a still quite huge, but a bi...

 
Did I get so many upvotes on my Sandboxed proposal because upvoting on meta results in an increase of hats?
 
@Downgoat Web Workers seem pretty disappointing in terms of what I need. Is there no way to pause until a message or Thread.yield()?
It's just a pure async fire-and-forget
 
I posted my first Jelly program. I am far too happy
 
@quartata is there a way to programmatically obtain the items in a steam inventory?
 
10:18 PM
@ConorO'Brien yes
 
inventory/PROFILEID/440/2?count=NUM for TF I believe
let me verify
Should give JSON back
@ConorO'Brien You might need to specify the language: l=english
It's a GET
 
0
Q: bROKEN cAPSLOCK kEY fIASCO

redstarcoderbROKEN cAPSLOCK kEY fIASCO Some of your employees have broken capslock keys and you're too cheap to replace them. Help them out by creating the shortest program possible to correct their work! Simply convert each character in a given string from upper-case to lower-case and vice-versa... but the...

 
@quartata okay. how do I translate item ID's to human readable text
wait nvm
 
Looks like 5000 is the maximum count for one request
 
10:28 PM
5000 whats?
 
Items.
That's what count controls.
Regenerator's source code is unreadable. :(
 
@noɥʇʎPʎzɐɹC Interesting name for a company. Are the intended customers medical patients or vampires?
 
So, I'm not sure if anyone here actually has any idea what my RProgN actually is, but anyway. I'm planning on replacing the currently bugging and barely used flow of control with functions that simply apply similar flow of control on 1 or more function arguments. Thoughts?
 
@Downgoat Just to confirm, setTimeout(..., 0); acts like a yield?
Python does that too but I wanted to verify
 
huh?
you can omit the trailing 0 btw
 
10:42 PM
Wait, what?
@Downgoat Do you know what Thread.yield() does in Java?
 
no
I know how to make BankAccountTester though
 
It doesn't sleep for any particular amount of time, it just yields (gives up) the thread's time slice.
 
@quartata setTimeout just schedules an async callback
 
so like performance.now()?
 
I don't want to a fixed tick rate in this busy loop because in idle time it'll be too slow.
 
10:44 PM
thread.Yield is completely different
 
TIL there are non-golfing languages that have a built in constant for TAU
 
@quartata yeah, that's not what you want
 
@VisualMelon I'm using setTimeout like sleep in this context.
 
oh, I see
 
This is truly infuriating. How does emscripten even work
when simple low-level concepts can't even be translated
 
10:52 PM
@trichoplax which one?
 
@Downgoat so what should I do?
I just want to sleep for a tiny tiny amount of time. 1 millisecond is too much.
setTimeout(..., 0) appears to do this so
 
1 MS is too long. Only on PPCG.
 
@flawr The example I saw was Nim - it has both PI and TAU in the math module
 
I've actually never see anyone using tau = 2*pi
Just heard of people debating over it in the internet, but IRL never.
Also: You cannot eat tau.
 
THE EMPEROR EATS TAU FOR BREAKFAST!
 
10:57 PM
oh! its hats!
 
@flawr I've never used it before today either. I had assumed only golfing languages would have it, to save a byte
 

« first day (2151 days earlier)      last day (2693 days later) »