« first day (2660 days earlier)      last day (2186 days later) » 

12:19 AM
ok would anyone mind posting some things in sandbox
 
@ASCII-only sure
 
12:39 AM
what's the shortest python expression to round a float x to an integer in a direction given by the sign of an integer d: ceiling if d>0 and floor if d<0 (d is never 0)?
 
12:55 AM
@xnor int(x)-(d<0) I think
 
@Pavel what about d
 
waffles
 
@Pavel that doesn't work if x is a whole number
 
oh yeah
 
ngn
implementing a proper floor in python is hard even without the d
 
12:59 AM
Ceiling.
My other mistake with thinking int(x) was Ceiling for some reason.
 
@Pavel it's truncate it's common knowledge
 
ngn
@Pavel int(x) is ceiling when x<0
 
;-;
@ASCII-only Fails, try changing one of the .45s to .55.
The result should stay the same but doesn't.
 
@Pavel :| oops
 
I tried doing a +.5 trick too :P
 
1:03 AM
@Pavel :| just realized since int is truncate, +.5 + round doesn't work
 
from math import*
lambda d:floor if d<0else ceil
@xnor ^, Curried, takes d as the first arg
 
@Pavel [floor,ceil][d<0]
 
Yes
from math import*
lambda d:[floor,ceil][d<0]
 
@Pavel *d>0. oops
 
¯\_(ツ)_/¯
 
1:12 AM
yeah it looks like having to specialcase integers makes it longer than that
@Pavel lambda x,d:[floor,ceil][d>0](x)
 
That's longer than just leaving it curried
 
depends on how many calls
 
I guess
@xnor Is this for a challenge? (Which one?)
 
for "Golfing out the haters"
 
Well, [floor,ceil][d>0](x) seems to be the shortest way.
 
1:20 AM
it takes an import
which I think makes it too long
 
Can't think of anything shorter
Maybe you can find another way to justify the import?
 
that's a fair thought
 
1:33 AM
in functional programming, how do I turn an integer into a list of even parts, applying the remainder to the initial elements?
for example, 9/4 would be [3,2,2,2]
10/4 would be [3,3,2,2]
 
@NathanMerrill functional?
 
I don't want to go back to a list and update it. I'm hoping for a math formula that I can simply apply multiple times
 
map floor-div-by-4 onto a list that counts down by 1
 
oooh....
 
@NathanMerrill something like int(n<a%b)+(a `div` b)?
 
1:36 AM
@xnor I actually think it's ceiling
maybe?
 
disclaimer: very pseudocode
 
10/4 = 2.5, but it should be 3
9/4 = 3, 8/4 = 2, 7/4 = 2
that's clever
 
oh yes it is
@NathanMerrill update it?
 
I could do floor division, make a list of N elements, and then go increment the first M of them by 1
 
@NathanMerrill but is ceildiv ever a builtin?
or are you doing 1 + floordiv(n - 1)
 
1:45 AM
I was actually doing floordiv(n + k - 1, k)
which is equivalent
 
(foo, bar) = a `divMod` b; return [foo + 1] * bar + [foo] * (b - bar) :P
 
Can I get chat.stackexchange.com/rooms/70344/cleaning-up unfrozen pretty please someone?
 
2:07 AM
@xnor hmm. actually lambda x,d:int(x)-(x%1!=0)*((x<0)+(d>0)-1) should be slightly shorter. if it actually works at all
 
@Οurous done
 
well, nvm. also TIL cmp is a builtin in Python 2 (well, I should have known this already)
 
2:44 AM
0
A: Sandbox for Proposed Challenges

ScrooblePolyraptor/Forerunner Combo code-golf mtg Notice: You probably need to understand the Stack in MTG for this challenge! A new expansion to the trading card game Magic: The Gathering, Rivals of Ixalan, was released this January. In this set were the two cards important to this challenge: Forerun...

 
3:13 AM
@Anush I think I understand.
Say, you assumes that the input is smaller than 100, so all arithmetic operations in my solution doesn't use numbers larger than 100, which are less than 64 bits, and can be performed in constant time.
However if the input gets larger (larger than 64 bits), each operation takes (at least) logarithmic time, and the comparison condition takes O(log(a[i])) times, which is not O(1).
Now (when you decide not to measure in bit complexity) there are some solutions that use big integer (Stax) and I'm not sure if they're correct.
 
 
4 hours later…
7:12 AM
@ngn great:D
@Pavel info is gender neutral
5
 
 
5 hours later…
12:39 PM
@xnor congrats on the gold badge!
 
1:02 PM
@anyone could operators have different precedence based on argument types? That wouldn't work for generics right?
like foo <ops> bar where all you know about the operators is that they have to operate on the generic type T
 
 
1 hour later…
2:30 PM
2
Q: split and capitalize

Muhammad SalmanChallenge : Given a string split at specific positions and capitalize the first character of the given word. Capitalize the first word's first char if and only if it was already capitalized Input : A string s and a character(!,@,#,$,%,^,&,*,_,-,.etc..) c. Ouput : The string with each occurr...

 
 
2 hours later…
4:58 PM
I'm asking mainly because of curiosity, but is there any infix golfing language?
 
yes, jelly
 
Uh, Jelly is everything at once
 
not really
 
5:20 PM
0
Q: Hurricane Detector

SquareootInput: Image via html5 drag & drop OR URL The image shows a satellite image of some part of the world with or without hurricanes. Output: Write / print / whatever: 'Hurricane detected' OR 'everything ok' Examples: Input: Output: Hurricane detected Input: Output: Hurricane de...

 
6:15 PM
3
Q: prOGraMMIng PuZZleS & cOde ____

ArnauldInput A non-empty encoded string consisting of printable ASCII characters (in the range 32-126), where some missing letters have been replaced with _. Output A decoded string of the same length with all letters in lowercase, including the missing ones. How? Gather all letters in the origina...

 
6:25 PM
@Pavel hey you use mono right?
 
Yes
 
how do you run programs with solution .sln files? I tried msbuild file.sln but it gave me no executable
 
That's the correct way. I don't know why it didn't work for your specific case.
Oh, you probably didn't look for it hard enough. The exe doesn't go on the directory root.
 
find .|grep exe gives no results :/
 
Yeah, idk why it didn't work. There's definitely a csproj there, right?
 
6:32 PM
(note I am not familiar with c#) yes, there is a csproj file
wait you worked on broccoli, I'll try building that to see if that works
 
Try msbuild Foo.csproj
@Cowsquack that's netcore, not mono
 
which csproj? There is one in core/ and one in the source_folder/
 
Are you sure this isn't a .net core project
@Cowsquack try grepping for dlls
 
it was originally created as a .net core project by someone who has actual .net
I am just trying to run that project in mono (because I can't get dotnet)
okay I found several, 3 under core/ and 2 under the project's folder
 
@Cowsquack you need core to run core projects
Mono won't work
 
6:40 PM
oh rip
@Cowsquack running msbuild says the build was successful though :/
 
It successfully built all framework, i.e. not core, projects.
 
@Pavel thanks though, good to know
 
My phone's near dead, so I gtg
 
7:31 PM
anyone watching eurovision
 
8:08 PM
I just (accidentally) found a really neat trick to golf my answer here
 
8:41 PM
@mınxomaτ Just found this explanation on the idea of "deep image priors", which (roughly) explains the idea of a paper that shows very promising results for a variety of tasks such as noise removal or inpaining. I thought you were interested because I was thinking back on the inpainting challenge!
@AdmBorkBork seriously, I thought things like that are against OEIS' rules!
 
@flawr I've posted that here quite a while ago.
 
@mınxomaτ sorry didn't see that. Did you make any experiments with that approach?
 
I don't have a GPU with enough VRAM to do any serious (inpainting) experiments. DIP works very well for artifact removal so far.
Dec 1 '17 at 14:28, by mınxomaτ
Looks like image prior will be the successor of classic EBII. Very promising results.
 
9:29 PM
-3
Q: How do we run a specific python function in sublime text 3?

Youness GouydYou can show me that in visual studio too.

 

« first day (2660 days earlier)      last day (2186 days later) »