« first day (2649 days earlier)      last day (2188 days later) » 

3:00 PM
@user202729 C++ has a class for that
http://en.cppreference.com/w/cpp/utility/optional
 
C++ also has nullptrs
 
@user202729 What do you mean with writing it just as I would when actually posting it? I did continuously update my sandbox answer based on the feedback I got
 
@RaisingAgent For example (1) title (2) winning criteria.
 
> The class template std::optional manages an optional contained value, i.e. a value that may or may not be present.
That describes every reference type.
 
Yeah, but this one explicitly may or may not be there.
 
3:01 PM
I only use optional when it's cleaner than a nullptr. aka rarely
 
Although this is C++ where value types are more common than in C#, which is what I'm used to.
 
Optional is a dumb idea imo
 
Agreed
 
@user202729 What does this mean? I googled it and searched around on ppcg and assumed it had something to do with hardcoded values
 
> Options are optional.
 
3:02 PM
@Poke explain why rust has Option<T> then. brb running
 
9 hours ago, by Pavel
Maybe in Haskell makes sense, since sometimes you do need a kind of Null value. What I don't get is Optional types in e.g. Java, where all it does is convert your NullPointerExceptions to NoSuchElementExceptions.
 
@moonheart08 recent versions of Java also have Optional
 
LOL
that's actually unnecessary
at least in C++ it makes an exception instead of a segfault
 
@user202729 I didn't have a title in the sandbox, I missed that.
 
yeah that could be useful
 
3:03 PM
(my keyboard is a bit broken now, brb)
 
@moonheart08 Checking for nullptr is significantly faster than exception handling.
 
but if(var==null) is just as bad as if(!optionalthing.isPresent())
 
@user202729 I will add the [popularity-contest] to the question body^
 
@Pavel True. Optional is good when you don't absolutely need speed tho. Rust does it right, and has actually fast exception handling :P
It has a similar usecase to http://en.cppreference.com/w/cpp/utility/variant
Being there for when you want cleaner code in exchange for a bit less speed
 
@moonheart08 Wait, are you sure it throws an exception? I'm pretty sure the C++ stdlib avoids exceptions everywhere except the parts that are explicitely for exception handling.
 
3:06 PM
Nope. I haven't really checked lel
/me checks
goddamnit this isn't IRC
Yup, a naked .value() throws an exception
.value_or(T data) will return data instead if it's not there
 
Mm
 
@Pavel :| explicitely
 
> We're trying to build a system better and easier to use than IRC, that is native to modern web browsers.
 
@user202729 yet they have no /me
 
@moonheart08 Even if the apparant overhead of the exception is small, the possibility of an exception being thrown means the compiler can't do optimizations it would otherwise do, so the code still ends up running slower than without exceptions.
 
3:08 PM
@moonheart08 Userscript...
 
> (since C++17)
Well that explains the exceptions
 
@RaisingAgent Actually I'm not very familiar with popcons. That's a commonly disputed topic. I'm also reading meta posts. codegolf.meta.stackexchange.com/questions/8084/…
 
@user202729 who's this
 
@ASCII-only I quoted that from the chat faq.
 
@user202729 :| well it's most definitely no better and no easier to use than IRC
 
3:13 PM
I'd say it's better
 
@ASCII-only How?
 
Transcript
Moving messages
Starboard
Replies
 
Moving messages?
Since when was the starboard better >_>
Okay. sure, but IMO the disadvantages cancel that out
 
@ASCII-only Yeah, you can move messages to more relevant chat rooms en masse
Like what?
 
Also, @Pavel, ZNC is a thing
 
3:14 PM
an API that makes the least sense ever mostly
the rate limiting metrics isn't great either
 
Rate limiting is good
It prevents spam
@moonheart08 What about ZNC? I've never used it, I just now it's an IRC client.
 
@Pavel *reduces spam. but really rate limiting is a terrible way to prevent spam
 
@Pavel ZNC is a bouncer style software. It keeps things like channel transcripts for you
it's not a client
 
@RaisingAgent Ok, I don't know what to say. Just that "I feel that the challenge is bad". Perhaps someone else can suggest to make it better.
 
it's a intermediate
 
3:16 PM
@Pavel IRC bouncer (i.e. has IRC logs)
 
@moonheart08 But can I use it to reply to a CMC someone posted two years ago? I think not.
 
@ASCII-only That's to prevent people DoSing the server?
 
@user202729 It would seem so :(
 
@Pavel If you were around two years ago, sure.
Just go back 2 years in your logs
 
@moonheart08 But the other person also needs to be using ZNC
IRC doesn't have replies
 
3:17 PM
True. also i have a hand written IRC server i made a while ago that has logs.
 
@user202729 yeah sure, but 5 seconds is quite a long time
 
It's not 5 seconds
It's 2 or 3
 
@ASCII-only I never talk that fast except in the sandbox. Also multiline messages are a thing.
 
Also, IRC networks can be extended. A lot. A lot more than you can do with SE :P
See things like Freenode's sigyn bot, which is a powerful antispam extension to their network
 
@Pavel idk. i swear it always says 5 seconds for me
 
3:20 PM
@RaisingAgent First, why making the input fixed? Why not "given those equations as input"? That would prevent hardcoding 100%.
 
sadly it hates it when we abuse the fact we have 20 different bots in our channel and kicks them all when we make them all shrug at the same time
 
Never seen it that much.
¯\_(ツ)_/¯
 
@user202729 good idea
 
What happens if there are no possible values? (x > 0, x < 0) Multiple possible outputs? (x > 0, y > 0)
 
false.
 
3:22 PM
@Pavel Not prolog.
 
@user202729 for the latter, Singleton variables: [X,Y]
 
Why not prolog?
 
@Pavel I know right Prolog is like the ideal language to use for this challenge
 
#include<iostream>
#include<optional>

struct Tree{
	Tree()=delete;
	Tree(int input){/* ... */}
	void do_something(int x){}
};

std::optional<Tree> t;

void process_t_recursively(int x){
	t->do_something(x);
	if(x)process_t_recursively(x-1);
}

int main(){
	int input;std::cin>>input;
	t.emplace(input);
	process_t_recursively(5);
}
So like that?
 
@user202729 t is never initialized.
 
3:27 PM
@Pavel t.emplace(input)
I suppose that's equivalent to t=Tree(input)?
 
@user202729 Don't you need t = std::optional<Tree>() first
 
(new deletd)
No, in C++ all non-POD variables are auto initialized.
 
@user202729 since when did this become C#...
 
@ASCII-only Because Pavel used new first...
 
@user202729 Ok, I just wasn't sure what the default value of a value type
 
3:30 PM
@user202729 also... does that even happen outside of a function
 
For POD ... wait why am I explaining C++ now...
 
@user202729 new isn't just a C# thing...
 
@ASCII-only But in C++ it's only used with pointers.
 
I typed new on accident but then corrected myself
 
@user202729 i don't think it happens for global variables though?
 
@user202729 onebox pls
 
Anyway. I feel that something is wrong.
@ASCII-only But I can't while pinging.
6 mins ago, by user202729
#include<iostream>
#include<optional>

struct Tree{
	Tree()=delete;
	Tree(int input){/* ... */}
	void do_something(int x){}
};

std::optional<Tree> t;

void process_t_recursively(int x){
	t->do_something(x);
	if(x)process_t_recursively(x-1);
}

int main(){
	int input;std::cin>>input;
	t.emplace(input);
	process_t_recursively(5);
}
 
@user202729 why not? replies are a thing...
@user202729 ???
 
Or should I do this?
#include<iostream>
#include<optional>

struct Tree{
	Tree()=delete;
	Tree(int input){/* ... */}
	void do_something(int x){}

	void process_t_recursively(int x){
		do_something(x);
		if(x)process_t_recursively(x-1);
	}

};


int main(){
	int input;std::cin>>input;
	Tree t (input);
	t.process_t_recursively(5);
}
 
34 secs ago, by ASCII-only
@Pavel pls onebox a smaller message pls ty
 
3:34 PM
TIL that = delete is a thing
@Pavel pls onebox a smaller message pls ty
 
@ASCII-only Nested onebox is a thing... please don't continue the chain.
 
@user202729 wat.
 
@user202729 If you assign values greater than 0, there shouldn't be multiple answers. I will add that to the rules (values must be > 0)
 
@ASCII-only yea, a function can be a direct reference to the destructor
@user202729 they're wannabe egyptians with their onebox pyramid
 
@moonheart08 weird, but nice
oh yeah. last time I was in the Sandbox there were people stacking oneboxes
I think I was one of them >_>
 
3:35 PM
@RaisingAgent What should the program return with input x > 0; y > 0?
 
Building quote pyramids is a offense that can result in thread deletion on bay12. Why? Lag. Oh and taking up the entire screen, but mostly lag
 
We have 10 kinds of sandbox: sandbox for testing, and sandbox for proposed challenges.
 
there's a testing sandbox?
goddamnit now i'm curious to see just how big a onebox pyramid can be
 
@moonheart08 room 1 ninja'd
 
3:37 PM
@user202729 It should output (as text?) which variable has to have the greatest/smallest value for the equations to return true
 
@RaisingAgent Then what's the answer for this?
 
@user202729 x < y < z
 
(this = x > 0; y > 0)
@RaisingAgent I think that programs must work for other inputs too? Why not?
 
Hmm. I've had a neat little question on my mind for a while: Is it possible, using AE2, Funky Locomotion, and Project Red (Mods for minecraft) to make a self constructing machine.
AE2 provides the self construction mechanisms..
 
@user202729 that it should solve any equation of that sort?
 
3:41 PM
6 mins ago, by user202729
@RaisingAgent What should the program return with input x > 0; y > 0?
2 mins ago, by RaisingAgent
@user202729 x < y < z
 
@user202729 x < y should be true
I don't understand what you mean
For it to work, none of the variables can be 0. Floats are fine
 
@RaisingAgent but you're not given x < y?
 
I'm not sure how input is defined. I was thinking of someone writing the equations as checks in code and giving them each a value til the checks return true.
 
4:03 PM
@RaisingAgent That's called hardcoding. Although that is rarely an acceptable input format.
19
A: Default for Code Golf: Input/Output methods

boboquackIn languages without any method of input (e.g. ///) programs may get input through an insertion into the source code

> In languages without any method of input
Generally it's not acceptable.
 
so apparently proton's parser is extremely slow all of a sudden
it was doing fine earlier and then I added keyword arguments and now it's like 5 times slower
 
Is that regex's fault?
 
it's modgrammar not regex
actually nvm has nothing to do with the kwargs
took 7.6 seconds to parse and evaluate print(*[1, 2], **{"end": " | bye\n"})
 
o_O
 
takes basically no time on print("hi")
 
4:08 PM
@HyperNeutrino what about print(*[1, 2])
 
so it's stepping back a lot
@ASCII-only basically no time (0.2)
 
@HyperNeutrino Is modgrammar based on regex?
 
@HyperNeutrino then why did you say this >_>
 
@user202729 I don't think so...
@ASCII-only because it was fine until I added it
wait
nvm it was a temporary thing with TIO being extremely slow during the first time I ran it
or not
6.8 on print(*[1, 2], **{"end": " | bye\n"})
1.5 on print(*[1, 2], **{"end": " | bye"})
 
First rule for using TIO to time things: don't use TIO to time things.
 
4:10 PM
mhm
I think parsing strings takes a long time...
 
@HyperNeutrino +1
 
hey i had this problem with the first iteration of proton
 
@HyperNeutrino yeah so it should be fixed this time round
 
class SingleString(Grammar):
	grammar = ("\'", ZERO_OR_MORE(OR(("\\", ANY), ANY_EXCEPT("\'"))), "\'")

class DoubleString(Grammar):
	grammar = ("\"", ZERO_OR_MORE(OR(("\\", ANY), ANY_EXCEPT("\""))), "\"")

class String(Grammar):
	grammar = SingleString | DoubleString
why would this be slow
 
Because it's based on regex...?
 
4:12 PM
@user202729 it isn't...
@user202729 well actually regex would be so much faster...
 
Anyway. What is ("\\", ANY)?
 
@user202729 backslash followed by any character
 
@user202729 you do know regex is basically native code speed right...
 
wait ANY is any string
 
@HyperNeutrino ew.
 
4:13 PM
that might be why; it has to step back once it doesn't match because it lost the last quote, which then takes exponential time lol
 
Regex concatenation is Modgrammar's tuplize?
 
@ASCII-only wat
 
@HyperNeutrino lost the last quote?
 
like, "hi" first gets parsed as ('"', 'hi"')
 
@HyperNeutrino it's like java verbosity. and uses constant case
 
4:14 PM
and then there's no close quote so it steps back
@ASCII-only modgrammar's fault
 
@HyperNeutrino protip: don't use modgrammar
 
no, ANY is a single character ._.
 
use charcoalgrammar or logocodegrammar
 
@ASCII-only ok i've had every single person tell me to use a different library lol
 
@HyperNeutrino just roll your own, it's what sane PPCG people do
 
4:15 PM
last time I tried that people said I was being too inefficient and told me to use a library
just look at Proton 1's parser
it's literally regex-based and O(n^2) best case (I think; could be worse)
 
@HyperNeutrino :| don't trust other people. most people here do roll their own
 
yeah I did that, but it took too long and is way slower than modgrammar
 
@HyperNeutrino >_> basically the same with Charcoal and logicode actually I think
@HyperNeutrino that sounds like ATaco and his O(2^n) parser lol
 
LOL mine might actually be that bad -.-
hm parsing strings is exponential time I think
 
@HyperNeutrino yeah just use a regex
 
4:18 PM
"hello" -> 0.2
"hello world" -> 0.6
"hello world my name is jeff" -> TIO TLE
 
both the practical(ish) languages i'm working on use regexes to parse strings
 
@ASCII-only yeah well I don't want to rewrite the whole parser and modgrammar doesn't have a regex class
 
@HyperNeutrino :| it's like 20 lines
 
@ASCII-only can see code?
 
4:24 PM
wat how does that even work
 
@HyperNeutrino for each thing -> try one subthing. if it fails, go to next subthing. if all fail, then thing fails.
basically
 
it's not very efficient, but it works
 
the thing is I can't look at Proton code to determine how to fix this because that tokenized first so strings are already represented as a token
 
I don't know enough about HTA and our quine rules to tell. Is this answer valid?
It looks like it isn't to me
 
4:33 PM
@HyperNeutrino ???
 
See? Our quine rules are very hard-to-define.
 
@ASCII-only like, Proton 1. it tokenizes first so strings are read by regex and then the whole token is parsed; with Proton 2, because it's using modgrammar, it's reading it char-by-char
 
Q: Why do we need the quine rules?
prevent cheating quines from getting upvotes and discourage others to write proper quines?
 
@user202729 it's a quine definition, not quine rules...
 
@ASCII-only The original defintion is "a program that prints its own source code". The other "rules" are added by PPCG.
 
4:36 PM
@user202729 They are hard to define, but that doesn't mean they're bad.
 
1 min ago, by user202729
Q: Why do we need the quine rules?
 
@user202729 I'd rather not see challenges over run by single digits and empty strings
 
I doubt such answers would get upvotes anyway (at least currently)
If upvotes are the main reason, blame SE.
I guess people would be fine if they're at -3 or something.
 
I would too, but we all know that isn't the case.
The top 5 deleted answers on Golf you a quine have 54, 40, 34, 30, and 21 votes, and none of them are close to valid or took any effort whatsoever.
The top one wasn't even golfed.
 
5:01 PM
I just found something really interesting you can do with python's duck typing
 
5:16 PM
@user202729 the problem with no quine rules isn't that trivial answers could get upvoted, it's that there wouldn't be a place and a reason to post better answers, which the rules force.
 
hi, is there a list of which esolangs have won the most questions on PPCG (determined by the SE api)? i remember seeing such a list a few years back but can't find it searching on meta
 
> sane PPCG people
10
 
@Downgoat oh wait yeah that's an oxymoron
 
26
Q: Golfing Class of a language

Not that CharlesI feel like we may have enough data on this site to meaningfully break programming languages into classes. What I mean by classes is akin to Go's ranking system: If a player can win 90% of even games against a 2 kyu player, the AGA believes he or she is 1.33 ranks higher, the EGF believes (s...

Was it this one?
 
@DJMcMayhem The most voted answer of ours all-time isn't golfed at all. (for those who don't know, see this)
 
5:31 PM
@Mr.Xcoder this is true
 
Hmm, good point.
@Mr.Xcoder The highest voted golfed answer of all time has a score of 68,068,736 :P
 
@DJMcMayhem I don't get it. Am I missing something?
 
@DJMcMayhem what's that for
QFT?
 
Ah Right :))
 
5:34 PM
(click the link...)
 
@ASCII-only Tetris digital clock
 
@DJMcMayhem "Well, the design is certainly not optimal."
 
Dunno about you, but I think Joe Z. really knows what they're doing. 3 of the top 4 challenges all time...
 
@DJMcMayhem Thanks, not exactly as I remember but that seems better anyways
 
Huh. Only 3 of the top-10 challenges are code-golf
 
5:44 PM
0
A: Sandbox for Proposed Challenges

Luis felipe De jesus MunozGessing the Grammatical Gender in Spanish Lets create a function which determines the gender of a given object in Spanish following the general rules and ignoring the exceptionally cases. Since this is not a Spanish speaking group, let me clarify some of the concepts. Grammatical gender in ...

 
@DJMcMayhem :| when Java is golfier than C#
 
Apparently since forever
 
Designing computers in The Powder Toy is a interesting challenge.
For one, you only have 29 bits to work with. (Although that's not too big of an issue)
1 bit has to be always on so that the number 0 can be represented.
(Also, i'm talking about FILT/PHOT/BRAY logic, not standard 1/0 logic which is also possible in TPT)
if that bit isn't 0, and no other bits are set, the FILT will take on a default behavior (color based on local temperature), BRAY and PHOT disappear.
 
@moonheart08 29 bits only?
 
@ASCII-only TPT uses only 30 bits to represent the color spectrum, which FILT, BRAY, and PHOT operate on. the 30th bit has to be a dead/always on bit so that 0 can be represented
Most modern TPT computers either use 16 or 29 bits
 
5:57 PM
@moonheart08 isn't 30 bits a lot for a color spectrum? also wait wat how do you even change the color of a pixel (also isn't 29 bits/pixel pretty dense anyway)
 
@ASCII-only a pixel/particle in TPT is like 32 bytes each lol. Temperature, life counter, data value 1, data value 2, secondary type, and two local values that arn't actually saved when the game is (and are as such rarely used)
all 32bit values
 
@moonheart08 i meant for the circuitry
 
@ASCII-only FILT can apply it's color to BRAY and PHOT
 

« first day (2649 days earlier)      last day (2188 days later) »