« first day (2117 days earlier)      last day (2726 days later) » 

6:06 PM
0
Q: Reducing fractions

BlacksilverI'm surprised this hasn't been done before. If it has, (a) Sorry. (b) It's a good thing to re-ignite the game! Input: a/b Output: c/d where c/d is the reduced form of a/b Rules Must be a full program, not just a function. Shortest answer in bytes wins. Whole number results may include t...

 
"I'm surprised this hasn't been done before" [closed as duplicate]
11
 
huhu, made me laugh @GabrielBenamy
 
> It's a good thing to re-ignite the game.
sigh
Meanwhile, rate my Python pastebin.com/raw/E4deD47W
 
I was going to say Code Review it, then I saw it...
 
6:23 PM
That's Hello World if you're interested
 
@Pietu1998 I'm glad you told me - that was going to take me forever...
 
@TimmyD I'm below 200 again in my C# answer, but I'm not entirely sure I can leave the System.Func<string,int[]> definition for the inner lambda out of the count.
 
@Pietu1998 how does this work?
 
@xnor do you know how decorators work internally?
 
6:28 PM
i thought they are functions that act on the function in sequence, but these don't look like higher-order functions
so i guess not
 
basically, a decorator is something that takes a function as argument and returns another "decorated" one. they just don't check that you actually return a function, meaning that e.g. using str as a decorator gets you "<function f at 0x12345678>"
 
oh, i see, all the functions are immediately passed to bool
 
0
Q: Helicopter challenge

MarchhillThere is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1 second. Or if it doesn't fly up it will fall 200 meters, which also takes a second. Build a program that takes input telling you to fly. When the helicopter falls it should output the time counter. I...

 
most of them yes
it can also use stuff like len(str(function)) to get 26
 
that's funny
and the decorating happens when the function is defined, so the code is executed without the function being called?
 
6:32 PM
and of course you can chain the decorators, so @len\n@str\ndef f(): pass makes f == 26
@xnor exactly, the functions are just dummies
you could put anything inside with no side effects, since the function objects get discarded
(except for default arguments which would be evaluated)
 
this makes me wonder if decorating has any golfing uses, but i can't think of any built-in higher-order functions usable in golfing
if there were a function-composition function ...
 
that might be cool
 
a lot of times you want to recurse on the input, but it requires some preprocessing, like converting a string to a number
 
that specific case shouldn't be a problem since int(k) == k for any int k, but I think I get your point
 
you're right, that's a bad example
 
6:37 PM
but splitting a string might a good example
 
Anonymous
@Pietu1998 You're a mad genius
 
@Pietu1998 apparently it doesn't even work: the recursive call invokes the decorated function as well
 
Anonymous
Please add a shebang to the decoratorator script for great good
 
darn, the decorator actually requires a def to work?
it seems to not work on a lambda or a named function or built-in
 
Aww, you can't self-decorate a function.
 
6:42 PM
@xnor when you decorate a function, you replace the thing you assign to the variable altogether. if you find another way to do that it might work
@xnor def or class. would've loved it on other stuff too
@Mego effort
 
Anonymous
@feersum Well no, because the symbol hasn't been defined yet
 
Anonymous
@Pietu1998 It's so little effort that even the lazy goat would do it
 
Anonymous
#!/usr/bin/env python3
 
@Mego It could conceivably have been implemented in a way that you can.
def g(): ..... g = g(g)
 
recursive functions also have the property that the symbol is not yet defined, right?
 
Anonymous
6:44 PM
@feersum Well your first problem is that you're trying to call a zero-argument function with an argument
 
@xnor The name lookup is done at execution time.
@Mego Don't take the example too literally.
 
Anonymous
Then provide a useful example :)
 
@feersum This would work if g was unary though
 
It doesn't matter what the arguments of g are, because it gets an undefined name error before it gets to that point.
@Pietu1998 No it wouldn't.
I mean, it wouldn't work as a decorator.
 
@feersum Well, this is true
Function variables only exist after being defined. They're not defined until the decoration is done
 
Anonymous
6:46 PM
>>> def g(x):pass
...
>>> @g
... def g(x):pass
...
>>>
 
Anonymous
I don't see the issue
 
Haha. The "issue" is that you had to write the definition of g twice.
 
Anonymous
Unless you're trying to use something before you've even told Python what it is
 
Anonymous
Trying to call a function before defining it is never going to work
 
If you were in bytecode you could duplicate the function before decorating and assigning it a global
 
6:48 PM
@BlueEyedBeast Imagine decompiling this
 
I don't think it would be too bad
 
Anonymous
Sure, it might work in bytecode, but not in Python
 
Or well, it might just be def g(x):pass\ng=g(g)
I bet decorators also get decompiled like that
 
Anonymous
You cannot use something before you define what it is. It's impossible. Thinking otherwise is a major logical flaw.
 
(Or with a temporary variable)
@Mego Recursion is recursion
 
Anonymous
6:50 PM
@Pietu1998 1) That's tautology. 2) What?
 
You can define recursion recursively
 
Anonymous
You mean like def g():g()? That's because you don't actually try to call something before it is defined. At the point of definition, there are 0 calls to g(), and there will not be any calls to g() unless you call it elsewhere.
 
the definition of a recursive function still occurs before the use of the recursion
right
 
In the dictionary you write recursion: see recursion. Stack overflow is when you've checked where recursion is enough times and forget what you were doing
 
even mathematically, you define f(n) = f(n) -1. f(n) is defined first
 
6:53 PM
f(f(n)) = f(n)?
 
@NathanMerrill f(n) is not defined first, but some special case such as f(0) is
 
Anonymous
Recursion doesn't require base cases. It's just a good idea to include them, or else you get stuck in an infinite hole.
 
that may be true, but doesn't have to
f(n) = -f(n)
 
therefore f(n) = 0 for all n
 
Anonymous
Or f(n) = ∞ on the projectively extended real line
 
7:07 PM
For chess geeks, The Lone King puzzle over on Puzzling is really awesome.
2
 
Yeah, I saw that. It looks awesome
 
Ooo, we're closing in on 100,000 submissions (questions and answers) total.
 
I love the step by step demonstration
 
Programming challenge: extrapolate the date and time of the 100,000th submission.
 
Are we starting a pool? Put me down for ~16 hours from now.
 
7:17 PM
@TimmyD How do you see the number of submissions?
 
post number
 
@TimmyD 14 hours, so 2016-11-16 0918 UTC
 
I love how sometimes, brainfuck answers get more upvotes than Jelly answers
 
@GabrielBenamy why is that surprising?
 
It's just amusing, because they're usually several hundred times the length
 
7:23 PM
@Geobits I may have just doomed myself, since I just posted a challenge which means the submission count is going to go up.
 
Hmm. Only 43 to go. I think 14 hours might be too far out too :(
 
0
Q: Create Fluffy Blocks

TimmyD(randomly inspired by this question) Let's make a drawing from some pipes | and hyphens -. If we pick a subset, you can see it forms a rectangular box or block shape (meaning that the corners are formed by |- or -|). For this challenge, we're concerned only with the corners - the vertical and ho...

 
@GabrielBenamy 8 hours
 
aww, I need 5k rep to see that
 
7:30 PM
The page you're trying to visit requires the privilege “access to site analytics.” ;_;
 
@GabrielBenamy I once posted a Pikalang answer at 848kB
 
I get ~27 more posts for today
 
@TimmyD it's not really clear from your explanation at the beginning that we need to be able to detect blocks that are covered by smaller blocks in front of them and what the exact rules are for that. after reading the first part, I assumed I'd always fill solid rectangular blocks of o into the input, before seeing the test cases.
 
@MartinEnder Thanks for the feedback. I clarified the challenge to state we're only concerned about the corners for detection and the edges and corners for fluffiness.
 
someone please stop me from trying to make a code ladder in COW
 
7:41 PM
it's still not super clear to me. from test case 5 it seems that one corner can be used for multiple rectangles. and it's also not clear that the edges can hold arbitrary characters. from the spec it seems like horizontal edges should be all - and vertical edges all | but the test cases have horizontal edges containing | (but not vertical edges containing -?)
maybe you might want to use a bigger rectangle than the minimal 4x2 in the spec already
and a test case containing something like this would be good:
|-----|
|     |
|  |-----|
|  |  |  |
|--|--|  |
   |     |
   |-----|
 
Anonymous
I'm predicting 6 hours
 
Anonymous
So around 6:45 PM CST (12:45 AM UTC)
 
oh damn I just figured it out
 
wat
asdf
 
About 3:30 am UTC
 
7:49 PM
What is that in GMT?
 
Greenwich-Mean Time
 
@KritixiLithos the same time
UTC == GMT
 
My computer science prof seems to like to grade things out of powers of 2. Homework assignments are typically worth either 8 or 32 points.
 
@MartinEnder Thanks again. Let me know if it's making more sense now.
 
looks great :)
 
Anonymous
7:59 PM
@PhiNotPi Your prof is my hero
 
Anonymous
I really like how my software engineering professor did tests. Every question had an answer from the lectures and/or readings. If you answered every question with the expected answer, you got 100%. However, if you answered a question with a different, valid answer, you would also get full credit, and possibly more if he thought it was a particularly interesting answer. He believed that, in "fuzzy" subjects like software engineering, reciting information wasn't as important as original thought.
 
In my school, I get grades out of 8
 
I like both of these profs :)
 
8:16 PM
39 submissions to go
 
wat
Should I buy a OnePlus 3T?
 
Buy a Google Pixel
Charges 7 hours in 15 minutes
 
wat
This charges 8 hours in 30 minutes, good enough
also this is $440, not $650
 
@wat It has twice as much RAM as my laptop...
 
wat
@trichoplax It has 1.5x more ram than mine...
 
8:19 PM
Will you need it?
 
@wat I'm still on a one plus one, and still haven't felt the need to upgrade
 
wat
@trichoplax VMs?
 
@wat do you know which countries it's available in?
 
If you run them on your phone then go for it. Personally I just don't need that much on my phone
 
wat
@NathanMerrill I'm on an iPhone 4S.
@trichoplax That was a joke.
 
8:20 PM
oh, if you're on an iPhone, then absolutely upgrade
 
iPhone is a joke
 
@wat I never know with people in here :P
 
wat
@betseg sadly no. I do know that it's a Chinese company.
 
People are arguing phones? This'll end well.
Also, everyone should use Windows Phone.
 
wat
@trichoplax There was someone who took an Asus ZenFone 2 (Intel processor) and installed Windows 7 in a VM on it.
 
8:22 PM
@TimmyD Haha, very funny
 
@wat I haven't had any trouble getting it in the US...but I can't speak for europe
 
wat
@NathanMerrill Isn't betseg in Turkey?
 
@betseg It wouldn't get through customs :(
 
It comes in a few weeks to Europse I believe
 
no idea
 
8:23 PM
I think the OnePlus 3 was available in the UK as I half considered it, so I'd guess this one will be too when it's released
 
@KritixiLithos I wasn't joking. Windows Phone is great.
 
wat
@trichoplax 399 gbp for 64gb model
 
@TimmyD Yup
 
yeah, my parents love the windows phone.
 
I used to use one, but dropped it to be able to use my pebble
In other news, using HAXM inside KVM causes a BSOD. Nice.
 
8:24 PM
Windows phones and iPhones are jokes
 
@Mego Smart guy. We need to get him to teach the HR departments of companies.
 
wat
@arda ?
 
@arda can't we get it even with taxes? ;_;
 
@KritixiLithos WP is actually good. It's very fast and battery consumption is amazing. But well... can't say that you'll get the newest apps on day one.
@betseg nope. I'll be in germany this summer though, might buy myself one :P
 
then i'll want from my uncle
 
8:27 PM
you'll have to get it added to someone's passport to unlock the imei though
 
@arda the default apps are pretty good though
 
or... you know... if you have any spare old nokias...
 
@arda ik
 
wat
Why does Turkey suck so much
 
Why would you need an App store? You're a programmer, you should make your apps yourself.
 
8:29 PM
@wat 7 letters. E, r, d, o, g, a and n.
@feersum Well, the APIs werent so great until the W10 for mobile update.
 
@feersum Yes, and spend hours on bugs
 
Real programmers don't add bugs.
 
wat
 
@wat yup
 
8:31 PM
IDK if @betseg supports him or not, but many people, including me sees him as a major reason of the issues in turkey.
 
do you think anyone who supports him knows english? :P
 
look at the tabela :)
van minut
 
> where is kravat
 
@betseg hahahaha (umm, can you mail me on p4p@protonmail.com)
 
^^, ^^^ and ^^^^ some of erdogan quotes
 
8:33 PM
Re: snippet testing, consider a submission (e.g.) where someone has posted a crack that is invalid, but hasn't removed their comment. I would consider these uncracked, but they do not appear in the list. — DLosc 28 mins ago
^^ Anyone have a quick fix for this?
I can't fix it myself (I only know MATLAB (and some Python)).
 
wat
@arda k
 
And for the love of erdogan use pgp keybase.io/ardao
 
wat
@arda ok so that's what you look like
 
@StewieGriffin use the overwrite part of the snippet? I think it has an admin user in it/
 
some versions of it definitely do
 
8:41 PM
@wat yes
 
or just flag the comment?
 
it doesn't look like this one has the override user feature in it though
 
It might be nice to have a solution that doesn't require mod involvement
 
@StewieGriffin BTW, I modified the PPCG userscript's leaderboard the other day to (mostly) support C'n'R challenges. It only says a challenge is cracked when the OP edited to say it is. (Not that that would help the 99% of people on the site not using the userscript...)
 
Does anyone happen to have knowledge of how double precision floats vary in results between languages/implementations?
 
8:44 PM
they vary
that's the extent of my knowledge
 
I'm trying to settle on test cases that will be achievable for all languages that use double precision, but be as challenging as possible given that requirement
 
@NathanMerrill really? in theory, definitely but in practice I think it should be fairly reliable. I'd assume most languages/architectures implement IEEE 754, which also defines how various operations should behave.
 
I made the mistake of thinking that if I restricted myself to cases that give the same result in Python for both double precision and arbitrary precision, then all languages would match those using double precision
 
2
Q: Choose the last card in a poker hand

Stewie GriffinPoker hands are ranked from best to worst as follows: Straight flush - five cards of sequential rank, all of the same suit Four of a kind - four cards of the same rank and one card of another rank Full house - three cards of one rank and two cards of another rank Flush - five cards all of the s...

 
I've been reading about double precision for IEEE 754, in case there is some leeway in implementation, but it's quite involved...
I might just resort to choosing test cases that work for both python and APL (the language my current test cases don't work for) but I just wanted to double check if anyone had an insight first
 
8:48 PM
@MartinEnder maybe I don't really know anything about how doubles vary :/
 
I have a vague idea from previous reading that some implementations use intermediate values with more precision than the operands (or is that some processors...?)
 
@MartinEnder You can still run into surprises with that, though. Like how .NET uses 15 bits of precision unless you specify full 17 bit precision when doing round trips.
 
What a terrible question for math homework: Lori wants to distribute 35 peaches equally into baskets. She will use more than 1 but fewer than 10 baskets. How many baskets does Lori need?
 
Between 2 and 9 baskets, inclusive
 
@Geobits obviously 4.375 baskets
 
8:53 PM
@Geobits Terrible because there are two valid answers?
 
It depends upon how hungry Lori is, if she eats some of the peaches before putting them in baskets.
 
@El'endiaStarman Yes, that. I mean, I guess it says "need" at the end, so you could argue five is more correct, but it's still terrible.
 
This could be the prelude to a scheme to crack RSA using 3rd graders.
 
Perhaps 33 might have been a better number of peaches.
 
@feersum Lori has 2^74207281-1 peaches ...
2
 
8:57 PM
what are we doing
 
Helping Minibits with homework.
 
Bitching about my kid's homework. Or at least I am :P
 
By cracking RSA
 
sounds fun, what's the problem
 
The problem is ambiguous wording.
(hah-ha, see what I did there?)
 
8:59 PM
:P
 
Scroll back like a dozen posts.
 
The Punmaster strikes again
He's terrible at baseball
 

« first day (2117 days earlier)      last day (2726 days later) »