« first day (1943 days earlier)      last day (2897 days later) » 

10:00 PM
Whoever came up with "C++0x" just wanted to make a dirty joke.
 
lambda n:reduce(int.__mul__,[2*i for i in range(1,n+1)if n%i<1])
lambda n:eval('*'.join(repr(2*i)for i in range(1,n+1)if n%i<1))
lambda n:eval('*'.join(`2*i`for i in range(1,n+1)if n%i<1))
lambda n:eval('*'.join(`(2*i)**(n%i<1)`for i in range(1,n+1)))
 
Chat mini challenge: Given a list of numbers, output an array containing each number N of the original list K times, K being a random integer between 0 and N. E.g., 3 4 5 can have 3 appearing 0, 1, 2, or 3 times.
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Pyth, 6 bytes: sm*]dO
@CᴏɴᴏʀO'Bʀɪᴇɴ lambda a:reduce(lambda a,b:a+b,map(lambda a:[a]*randrange(a),a))
 
@LeakyNun again, int.__add__
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Does Jelly have random?
 
10:09 PM
@LeakyNun IIRC, yes.
 
@Maltysen Does not work
 
why not?
oh i see
@LeakyNun list.__add__?
 
> X 1 Random; choose a random item from z if z is a list, or from 1 to z inclusive if z is a positive integer. If z = 0, return z. Error if z is negative or a decimal.
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Oh, I meant J
lambda a:reduce(lambda a,b:a+b,map(lambda a:[a]*randrange(a),a))
lambda a:reduce(list.__add__,map(lambda a:[a]*randrange(a),a))
 
10:10 PM
@LeakyNun also, IIRC comps are shorter than lambdas+map
 
@CᴏɴᴏʀO'Bʀɪᴇɴ You know, those names kind of obfucksate their functions
 
@LeakyNun you aren't meant to use list.__add__ in any real programming
 
@Maltysen What is comp?
oh ok
 
comprehensions
the .__add__ is what is called when you use + and is meant to be overloaded
 
@LeakyNun Kinda, yeah
 
10:12 PM
lambda a:reduce(lambda a,b:a+b,map(lambda a:[a]*randrange(a),a))
lambda a:reduce(list.__add__,map(lambda a:[a]*randrange(a),a))
lambda a:reduce(list.__add__,[[i]*randrange(i)for i in a])
 
@LeakyNun remove space after randranfe
 
@CᴏɴᴏʀO'Bʀɪᴇɴ (Not-tested) (?#])"0
 
what's with the trailing @?
 
Oh, ? is rank 0
that's why I should memorize the ranks
 
also, ? is 0 to n -1
not 0 to N
 
10:15 PM
oh...
(?@>:)#]
 
0
A: Sandbox for Proposed Challenges

msh210code-golf Directly from http://stackoverflow.com/q/37447114: Challenge Find the longest run of true in a list of booleans. Return the same list, with all other trues falsified. Input A list; any usual format. Output Same as input. Details If there's a tie for longest run, keep all tying ...

 
tested
 
suboptimal...
 
erm, does anybody that participated in my "Common vs Generated password" challenge have a local copy of the common password list? @Dennis @Sp3000
 
@CᴏɴᴏʀO'Bʀɪᴇɴ You know, ?@>:#]
?@>:#] (fork)
#~?@>: (hook)
 
10:20 PM
@LeakyNun ɢᴏᴏᴅ ᴊᴏʙ
always remove parens :p
 
lol
 
 
bah, its not on wayback machine either
 
wtf cloud9
 
Chat mini-challenge: given a list [0,0,1,1,1,0,1,1], transform to [0,0,1,2,3,0,1,2] (can someone help me to describe in words)
 
10:23 PM
sum of all previous elements, up until a zero is reached
 
thanks
 
0
A: Sandbox for Proposed Challenges

xnorSquarefree decomposition code-golf Given a positive integer n, output positive integers a and b so that n = a^2 * b with b squarefree, i.e. not divisible by any perfect square except 1.

 
@LeakyNun will it only be a binary list?
 
@mınxomaτ if i log into my ppcg account on codegolf.xyz, will you have my login credentials? I dont see any ssl
 
Here's a dyad parenthesizer thing I hacked together in J ('('&,@:[) (, ' f '&,) (,&')'@:]). J is weird but awesome.
 
10:28 PM
@Maltysen Yes, I forgot to mentionthat
 
@Downgoat Login is disabled.
 
@mınxomaτ oh
 
@Cyoce What does that do?
 
Why?
 
@Downgoat Read my meta post.
 
10:29 PM
@LeakyNun takes x, y and returns '(x f y)' (as a string).
 
I can't open it right now, my ping to SE is > 3000ms
 
@LeakyNun sm?edShdmZhdrQ8
 
@Cyoce Does it need to be thaaat long?
@Maltysen I did it in 9 bytes
 
@LeakyNun is it counting up or summing previous elements?
 
._.
 
10:30 PM
@DrGreenEggsandHamDJ Counting up
 
@LeakyNun No idea. Shortest thing I could come up with tacitly.
 
k lemme think
 
@Maltysen note that it will only contain 0 and 1
 
@LeakyNun .u?Y+NYZQZ
10
this doesn't even require only containing only 0s and 1s
 
close
a little modification can golf it down to 9
 
10:35 PM
@LeakyNun ooooh got it
.u*Y+NYQZ
 
produce wrong output for [0,2,3,4] (although not needed
hamming distance 1
 
@LeakyNun between what?
 
Between the answer you just submitted and the optimal answer
 
oh
.u&Y+NYQZ
 
brilliant
alternative using m
also 9 bytes
try it
 
11:07 PM
Chat mini-challenge: given a mapping from the integers from 1 to N to the integers from 1 to N (represented by array), determine if the mapping is surjective, injective, bijective, or nothing.
you may choose any character/digit for the four outputs
format: n, arrays of pairs
for example, {i+1 | i from 1 to 9} (n=10) is represented by 10, [[1,2],[2,3],...,[9,10]]
testcases: 2, [[1,2],[2,1]] => bijective
2, [[1,1],[1,2]] => injective
3, [[1,1]] => nothing
3, [[1,2],[2,3]] => nothing
duplicate guaranteed absence
4, [[1,2],[2,2],[3,2],[4,2]] => surjective
 
11:27 PM
C`qRSQSMCE
@LeakyNun ^
 
digit. not number.
@Maltysen iqRSQSMCE2
 
@DrGreenEggsandHamDJ OK, I'll look at it later. Don't worry about encoding and file I/O. I'll take care of that.
 
@Dennis Pyth short-circuits the and by using eval, perhaps you can short-circuit the and by using special casing
 
Ok thanks. Although fair warning, V is really picky when it comes to file encodings.
 
in that case you can special case multiplication too
 
11:40 PM
Dos TIL TIO add a newline to the end of the source?
 
@LeakyNun Logical and cannot short-circuit because it vectorizes. Even if it didn't, logical and would have to be a quick to have an effect on the right argument.
@DrGreenEggsandHamDJ TIL? TIO doesn't.
 
That's what I said.
@Dennis Ok, that's good to know. Occasionally certain programs can be further golfed without a newline.
I'm headed out. Feel free to ping me if you run into anything.
 
Chat mini-challenge: repeatedly divide by 2 until odd (subset of Collatz)
Java: int f(int n){for(;n%2<1;n/=2);return n;
}
 
11:57 PM
Python, some number of bytes: f=lambda x:x if x%2 else f(x/2)
 
1
Q: Surjective, Injective, Bijective, or Nothing?

Leaky NunGiven a mapping from the integers from 1 to N to the integers from 1 to N, determine if the mapping is surjective, injective, bijective, or nothing. You may choose any character/digit for the four outputs. Specs Input format: n, arrays of pairs (n is the highest number in the domain and range)...

 

« first day (1943 days earlier)      last day (2897 days later) »