« first day (2352 days earlier)      last day (2786 days later) » 

17:00
@ETHproductions Object.defineProperty(foo, "bar", {set:function(x){this.bar = x; Object.defineProperty(x, "goat", {set:...})})
function(){var a = 1;} what object is A on?
@ETHproductions not quite everything, 1.foo = "bar"; is invalid :P
@JanDvorak But what if you don't know that someone is going to set the goat property?
^ also you'd have to move goat setter inside other setter
So? Then the setter won't be called.
17:01
@JanDvorak The original question was how to tell if an object was changed at all, I believe.
javascript
@StepHen well that is syntax error but 1..foo is accessible
Well, that's not as easy. But you can enumerate properties and attach setters to all of them.
You can't enumerate properties that don't exit
Yeah, you'll miss those. Was that a requirement?
17:02
Yeah because empty object doesn't have any properties
We want to know if anything changes on an object. For example, write a setter that detects when this code is run, without using <expression>: foo[<expression>] = 1;
Setters won't do that job, then
What you could do is attach a global detector to Objects proto
You could attach a proxy in your setter
If you can run a function on yourself frequently enough, you can check for changes there.
17:05
@CalculatorFeline bad idea
	for (var index = 0; index < arr.length; index++)
		if (index === arr.indexOf(arr[index]))
			perm(arr.slice(0, index).concat(arr.slice(index + 1)), len - 1).map(function(b) {
				result.push([arr[index]].concat(b));
			});
@StepHen Happy? :P
At least now I don't have to do +index every time
If I make a functional operator TC proposal does anyone else want to help make?
@ETHproductions Yes :P
@Downgoat I'm not sure what this functional operator you're talking about is
17:07
@ETHproductions basically (+) == (a,b)=>a+b
Cc @ConorO'Brien
Would (~) be invalid then?
Eh, it's not as groundbreaking if you're not ... wait, this is TNB. Go ahead.
Why would it? That would be unary functional op
17:08
But then how do you get unary (-)? :P
(-) might be both unary and binary based on how you call it
good question though
Either 1) call 1 arg does unary and with two does binary 2) (:-)
Cheddar does borh
What does 1-arg call do with (*) ?
* is not unary arg
17:10
Hence the question
Btw ... is not an operator in JS but often described as one
Error I'd say
Because a* is a SyntaxError
One issue is that (?:)(a, b, c) can't be equivalent to a ? b : c
similarly with (&&) and (||)
I wouldn't allow (?:) if I were in charge
The other two though, idk
Why not? The desired behavior is clear.
17:11
I still don't understand where this'll be used
^^ we can still have but not short circuit
not short circuit = not identical
tfw you look at VSauce's old videos and realize that indeed everyone has a dark history
Since JS is becoming example of functional programming would be great for functional program
@StepHen sum = array => array.reduce((+), 0)
for 1 example
17:13
@Downgoat Syntax error: failed to parse the grammar structure of this sentence
3
Q: Fibtraction - Fibonacci but with subtraction

totallyhumanThe Fibtraction sequence (as I call it) is similar to the Fibonacci sequence except, instead of adding numbers, you subtract them. The first few numbers of this challenge are: 1, 2, -1, 3, -4, 7, -11, 18, -29, 47, -76, 123, -199, 322, -521, 843, -1364... The sequence starts with 1 and 2. Ever...

My controversial sandbox post is doing well on main :D
@totallyhuman good :)
17:22
The sandbox is fundamentally broken :P
@JanDvorak We need a meta-Sandbox to fix Sandbox
There already is one, and I'm not sure it helped
> á: function(x){var p=[],u=[],f=function(z){...};var l;return f(this).map(function(z){return z.slice(0,x||z.length)}).â()},
Note the extraneous var l;
Old me was incredibly dumb :P
@ETHproductions var p=[],u=[] => var p = u = []
Welp first downvote
17:29
@NewMainPosts as ETH said is near dupe of lucas but with - instead of +
Any reason why not dupe?
@StepHen That actually is very wrong, as any changes to p will then affect u
@Downgoat We don't have a Lucas sequence post, as far as I know?
@ETHproductions oh right, yeah, don't listen to me
@Downgoat Oh wait we do, but it was closed as a dupe of something else
Yeah :P
But I don't think the current post is a dupe of codegolf.stackexchange.com/questions/64476/… though
;-; ok
Guess that's that
17:34
Wait, I thought someone discussed this in the Sandbox and came to the conclusion that it's different enough
From totallyhumans quote he is saying old one sucks but is still dupe
It was controversial
we can discuss here about improving the Fibonacci challenge though
Not gonna bring any activity to it though
17:35
The challenge being old also does not stop it from being dupe
For every operator returning a boolean (e.g. <, >, in, instanceof) JS should have a version with a preceding ! that returns the opposite
So that we can change e.g. if (!(x instanceof Array)) to if (x !instanceof Array)
yes pls I hate doing if(!(a instance of T))
Does anyone else here on es discuss?
@ETHproductions I like the idea of !> and !< instead of <= and >=, and the others all sound more readable that way too. Suggest it to W3C
*TC39
Is that the new standards committee?
17:44
They do ECMAScript, JS as a language W3C only does the browser specific stuff
OK so how do I propose something like this?
@Downgoat Ah I see. Thanks
Though TC39 does have representatives from most browsers
@ETHproductions first make a markdown file describing spec
I guess the other way is to talk one or more browsers into implementing it to gather support
then you'll need a champion to present it to TC39 comittee
17:46
...I was afraid it wasn't any simpler than that -_-
I use !> and !< when writing by hand, because it feels more intuitive, and then when typing up as code I change to <= and >=
^ I always have to spend like a minute thinking what weird side effect will happen when switch
Might also be because I am dumb
Maybe implement it in other languages so people get used to it and it can spread out into more and more languages until JS naturally follows
@Downgoat Yes it's definitely a source of delay and error. I'd love to be able to just leave it as !<
The only reason I put up with the risk is that the ease of working with it on paper seems to justify it
Random question: Roughly what proportion of time working on a JS project would you expect to be "getting it to work on IE"?
Question: NaN <= 0 is false, but NaN > 0 is also false. Should NaN !> 0 be false (as in NaN <= 0), or true (as in !(NaN > 0))?
@ETHproductions what the hell
17:54
Hey, JS isn't my fault :P
NaN === 0 returns false and NaN !== 0 returns true. I'd guess anything that's not a number isn't going to be equivalent for !< and >=, whether it's a string or NaN or whatever.
term !> term should be syntactic sugar for !(term > term)
^ that's kinda what I thought
But I think JS just has all comparisons with NaN return false, so I don't want to break that
Isn't the NaN weirdness part of the floating point standard? One thing that can't be blamed on JS...
@ETHproductions !== returns true, so there's no hope for consistency
@trichoplax Yup
17:58
oh... darn
@trichoplax NaN does not equal any number, so NaN !== num returns true
I agree the !(a>b) seems the most intuitive meaning for a!>b
so what about !<= and !>= XD
hi all
@StepHen That was going to be exactly my argument for !> returning false, until I tested in a browser and found NaN !== 0 returns true...
18:00
if you haven't seen it, my meta question is up re: time limited code golf questions
waiting for your opinions :)
@trichoplax Mistyped sorry
Excellent - off to have a look...
but please do read the whole question as I cover a number of points
7
Q: Do we need a new tag for time limited code-golf?

LembikI like to ask code-golf questions but I typically don't want to see brute force solutions. The challenge I like to pose is to golf any reasonably fast solution for a (possibly hard) problem that will actually terminate in a reasonable amount of time. Examples of such questions (not all by me) in...

@StepHen NaN !== x returns true for all x, haha
> you have more in common with a stranger today than you do with yourself ten or twenty years ago
18:03
@ETHproductions That's what I'm saying
I am thinking it will really annoy people if I ask for fastest-code that you can tweet... right?
@Lembik Depends on tags
@StepHen ok so let me be more concrete and maybe you can help
@Lembik If it's tagged dunno why anyone can complain
That seems a valid challenge, but as you mention that's the other way round from asking for shortest code that meets the time requirement
18:07
I would like to ask for the fastest integer factorization code that fits in 140 characters
@trichoplax it is indeed
@Lembik Don't see anything wrong with that
@StepHen cool!
I don't see anything wrong with either
people may complain it excludes java :)
The problem is when the winning criterion is not the most important one
18:08
well you will need to do a lot of golfing
When you're saying "the fastest code that is at least this short" that's fine
so you are again having to achieve two things
Upper limits on size or running time will exclude some languages, but if we only have challenges that include all possible languages then we'll miss out on lots of interesting ones
2
it's exactly the same as the smallest code that runs in less than one minute
which upset a number of people
well the same idea, just the other way round
@Lembik No it's not, it's flipped on its head
18:09
@StepHen right.. the same principle
All code golf challenges already have at least 2 objectives: the spec and the code length
optimise X subject to a limit on Y
@trichoplax I agree completely!
but people got all upset and I had a number of downvotes
ok here goes :)
You're not Sandboxing it? :P
well chat probably pays more attention than Sandbox anyway
In between the extremes there is "your code must be tested", which doesn't specify a time but you can't post until the program terminates. Some would require that all code is tested anyway...
@StepHen I will sandbox so we can discuss it :)
@trichoplax I tried that .. people also got upset!
oh the sandbox isn't linked any more
from the main page
18:12
I think whatever you do someone will complain. I'm interested to see how meta responds, to get a better idea of how many people support each side
@trichoplax thanks. Me too
no answers yet
> Feature requests for future versions of ECMAScript should not be made in this repository. To make a feature request, post to the es-discuss mailing list. Your goal will be to convince others that your proposal is a useful addition to the language and recruit TC39 members to help turn your request into a proposal and shepherd it into the language.
@Downgoat
err...how do I find the sandbox?
338
Q: Sandbox for Proposed Challenges

SandboxWhat is the Sandbox? This "Sandbox" is a place where Programming Puzzles & Code Golf (PPCG) users can get feedback on prospective challenges they wish to post to the main page. This is useful because writing a clear and fully specified challenge on the first try can be difficult. There is a much...

@Downgoat absolutely not, sorry
18:13
thanks!
@Riker I totally read that the wrong way at first
I've flagged it for a mod to add the featured tag back on
@trichoplax Why does Community do stuff like that? 0.o
Because there are more cases where it's useful to remove the featured flag than cases where it isn't :)
We're abusing the featured feature because we don't have a mechanism for permanent notices (yet)
@trichoplax Oh, that makes sense
18:16
74
Q: We're not a Q&A site. But what should be done about it?

Martin EnderIt has come up several times recently (more than usual) that PPCG differs from most of the other Stack Exchange sites in that it's not a Q&A site. People don't come here to ask a question because they have a problem, people come here to solve recreational challenges. The most valuable contributio...

I'd say that the featured tag shouldn't be removed by a time period, but when the question stops gaining attention. Just randomly removing the tag helps nobody
@ETHproductions imo false
@Downgoat I'm still learning julia, are you trying to learn it also?
Yeah I'm trying to do some 3D ANN stuff with GPU and C++ is too hard so trying to use Julia
I don't actually know if Julia has CUDA bindings though
18:29
@Riker huh for some reason the notification for this does not have comma
@Downgoat ye I edited
0
A: Sandbox for Proposed Challenges

LembikTweetable integer factorizer The task is as follows: Write code that factorizes integers as quickly as possible subject to your code being no more than 140 characters long. Your code can take input and give output in any way that is convenient including for example as arguments to a function. ...

comments please!
in particular, how precisely do you measure the length of a tweet? Is is characters or bytes for example
@Lembik UTF8 bytes
@Downgoat So I would say 140 UTF8 characters?
18:37
@Lembik Past challenges have done chars, or just done bytes like regular challenges
up to you
@Lembik well twitter doesn't have any specific encoding tweets use (the solid byte limit is 140) but online tweeter uses UTF8
I may go for bytes... seems simpler
thanks @Downgoat
Use bytes if you want languages with different encodings to be included
do I need more testcases?
@trichoplax bytes it is
I think test cases are good but need more spec on timing
is program startup time included?
18:42
I'm guessing no one is going to be able to hard code the existing test cases but they might be able to simply hard code what distinguishes them. More test cases might be easier than trying to objectively rule out hardcoding.
are you going to do like time ,/myprog
@trichoplax hardcodjng in this case is loophole abuse anyway I think and IIUC answers should still work for other numbers
@Downgoat aha.. I was literally going to do time ./myprog
@Downgoat can you suggest some wording for this?
I think you should allow custom timing scripts e.g. let start=nanotime(); factorize(283844288373); print(nanotjme() - start)
@Downgoat Ah yes "should still work for other numbers" seems to cover it. Maybe with a specified range over which it should work?
@Downgoat would you mind editing my question?
or @trichoplax too
18:46
Sorry in mobile rn so not so easy to edit
For like C, what is stopping me from using preprocessor to generate giant list of prime factors and doing lookup
BrainFlak CMC: swap contents of both stacks.
@Downgoat If I am running time ./myprog wouldn't that take forever?
@Downgoat I am not sure how to allow custom timing scripts. They wouldn't be in the answer so how would they be provided?
I suppose the answer could say how to use special timing script and if they don't just use time
@Downgoat that would need your help :)
it sounds complicated
currently I have "I will literally run time ./myprog on my Ubuntu system to do the timing so please also supply a complete program for me to run that includes any function you have defined."
Though with time I reccomend do like time [:] as a baseline because like even if I run empty program time says it takes like 0.013s on my computer
18:52
0.013s is not a lot compared to 10 minutes
there aren't many test cases
89
A: Calculate the number of primes up to n

DennisC, 0.026119s (Mar 12 2016) #include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #define cache_size 16384 #define Phi_prec_max (47 * a) #define bit(k) (1ULL << ((k) & 63)) #define word(k) sieve[(k) >> 6] #define sbit(k) ((word(k >> 1) >

That question says you can only hardcore up to 19 & answer must be deterministic. Maybe similar thing here?
@Downgoat I am not sure what that would mean given the test cases
@Lembik latter part meaning you can't do isfactor(random()) and say it worked in 0.03s one time! Former meaning you might want to just say no hard coding any values
@Downgoat but it does say that
Is the giant list of hardcoded primes a problem if it has to work for all numbers in range anyway? If "work" means return within 10 minutes
18:56
@trichoplax I don't understand how you make this giant list quickly
oh you mean at compile time?
Downgoat's suggestion was to generate it at compile time
yes :)
it would have to be too large to ever work
look at the size of the test cases!
it would never finish compiling
So you're happy for people to generate a smaller list of primes, provided it compiles on your machine in less than N minutes?
sure
ah ok.. I see you want me to include the compile time.. ugh
this is a pain :)
I mention it for your benefit - if you don't specify then you're the one who is going to be compiling all these programs on your own machine and wishing you had specified :P
18:58
how about languages that are compiled must take less than 30 seconds to compile?
@trichoplax thank you!
I don't suppose the time limit matters much more than the 140 characters limit. As long as it's specified there's no "best" limit

« first day (2352 days earlier)      last day (2786 days later) »