« first day (1432 days earlier)      last day (3429 days later) » 

7:27 AM
new year eve . Ought to be silent ...
 
7:40 AM
@Sp3000 started on parser for CJam
 
 
2 hours later…
9:16 AM
There is no way to close a question as spam ?
 
@Optimizer Just open the flag dialog and select the first option "spam".
After 6 flags, it will be auto-deleted.
 
ok
 
oh, it already is deleted \o/
 
community FTW
 
10:13 AM
CJam parser woo :D
 
10:47 AM
@Doorknob冰 Do you think if we can get some support for this on meta, we could get the devs to activate SoundCloud embeds for PPCG? I think that would greatly increase the feasibility of audio processing challenges.
 
11:04 AM
Hasn't it been more than one week already ?
 
@Optimizer yes, we extended it by another week
yay, I've finally got a nice idea :D
(although it's stolen...)
 
Posting it soon? :P
 
yeah, it's in the sandbox right now
 
0
A: Sandbox for Proposed Challenges

Martin BüttnerUnflatten an Array code-golfarray-manipulation Inspired by this question on Mathematica.SE. Say you've got a nested list/array of some arbitrary structure (the lists at each level don't necessarily have the same length). For simplicity, we'll assume that the nodes are non-negative integers. As...

 
there you go
the Mathematica solution to this is so ridiculously clever :D
 
11:12 AM
Ooh that's interesting
You've already come up with an answer?
 
see the linked question
 
Oh the first link, right
 
I never would have come up with that :D
if I golf that down it's 62 bytes. I hope that should be beatable
I think some recursive Pyth solution will probably beat it
but just in case, I think I'll just post the golfed version of that myself, and declare that I won't accept, so no one can just steal that and kill the challenge
 
I don't think Pyth has type() inbuilt, so the solution I'm thinking of would take a bit longer
*need more bytes
That might be a good idea
 
44 bytes...
 
11:18 AM
Can you have an empty list on its own somewhere? eg [[],[],[[1,[]]]
 
oh, that's a good point... hmm...
 
I was assuming no, but to make sure
 
the mathematica solution can handle it >:D
 
I'll try in Python when I get back :P
 
@Optimizer you wanna try that one in CJam and JS? ;)
 
11:23 AM
I think what I have in mind can handle it
 
@MartinBüttner I might if someone stars this :P
 
But stack snippet :P
 
@Optimizer that's a bit too desperate ;)
 
@Sp3000 In progress
 
@Sp3000 but 30 minutes.
 
11:25 AM
@MartinBüttner Isn't that desperate ? :P
 
lol
even if you did, I doubt it would make 30 minutes, to be honest
 
I can post 2 answer
 
but I'm not starring messages that ask for stars ;)
 
@Sp3000 can 2, and you 1 :P
@MartinBüttner I have so many others :P
 
I don't know if self-answers count
 
11:26 AM
Oh pizza, right
 
we will have to try
 
Oh I don't need to use type, there's a golfier way...
 
@Sp3000 added examples for empty lists within the tree
 
can i have the nested list as a string and the values list as an array in JS function argument ?
 
@Optimizer hm no, consistent representations please, I'll clarify that
@Sp3000 43...
 
11:32 AM
ugh, you just elongated by 40 byte JS solution
 
can't you toString it manually?
 
that is what elongation means, I think.
and no.
toString is stupid
46 :(
 
@Optimizer but it wouldn't be 40 bytes
@Optimizer wow, that's actually pretty good
 
no, a 40 byte solution went to 46
that's not good
 
oh
"my 40 byte solution"... not "by 40 bytes"...
 
11:35 AM
oh. err.
 
the 46 can handle empty sublists?
 
anything
 
@MartinBüttner Can we regex replace digits with digits?
 
@Sp3000 oh...
 
11:38 AM
regex was not allowed ?
mine uses regex only :P
 
@Optimizer well what's the point if we do this with regex
 
are you officially banning regex ?
its clever via regex
 
I'm pretty sure I will... this is boring with regex
 
I just thought about it because I'm using str(L)<":" to check if it's a number or a list
 
@Sp3000 well that's fine by me
hmmmm
@Sp3000 what do you think?
 
11:42 AM
The easy way out would be to ban conversion to strings (because you can always just do the regex approach without regex by traversing the string)
Whether it's shorter is another question though
Otherwise banning only regex could work
 
@Sp3000 good idea, done.
 
if regex was allowed, CJam would have got tough competition from other languages. but not anymore
f=(a,b,i=0)=>a.replace(/\d+/g,x=>eval(b)[i++]) f("[0,[1,[]],[[]],[2,3],[]] ","[1,6,1,8] ") My solution using regex.
 
how much do you need in CJam?
 
did not try
 
@Optimizer yeah, while it's a nice idea, it really circumvents the actual challenge ;)
 
11:48 AM
the actual challenge is to get 5 answers in 30 minutes, no ? ;)
 
lol
@Optimizer I don't think a regex-based approach in other languages would be much shorter, except maybe Perl. and Mathematica is still 43, so that 46 was competition for CJam than Mathematica still is ;)
 
bash
 
hm yeah maybe
 
115 in Python, I think I'm doing it wrong
 
@Sp3000 recursive solution?
 
11:52 AM
Yeah, but I defined two functions because the first one returns the list and the next element index
 
oh i got a nice idea
recursive
 
hi all
happy christmas/new year/everything else
Two binary strings: x and y. Simple matching = count the number of matching digits.

What kind of strings will have the property that the match is better when y is shifted to the left relative to x rather than to the right.
a puzzle to think about :)
 
44 in JS without regex
 
Is this cyclically shifted so that the last element goes to the front, say?
 
11:58 AM
@Sp3000 yes
 
Strictly better or better-or-equal?
 
@Optimizer see ;)
 
In particular (say) the match count is more then 50% for each of the first 10 shifts to left and less than 20% for the first 10 shifts to the right.
@Sp3000 ^^
 
@Sp3000 bloody hell...
 
:P the only smart thing done there (and I have no idea how to backtick in chat)
 
12:02 PM
sorry about all the pings
 
pretty sure it can be done much shorter than 44 in python
now if only online pyth compiler was working
 
Pyth, maybe. I can't figure out how to use D though
 
what is D ?
define ?
y() ?
 
@Lembik Hmm interesting, makes me want to try with a bunch of strings but maybe later :P
Define, yeah
 
its easy
lambda based define and then to use, call y
 
12:05 PM
Er... I can't lambda with the approach I'm using
 
oh wait, D does not lambda
its a normal function and u return by ) or R
so say u r creating a function with 2 arguments, you can do D<XYR+XY<3T
will return 13
 
Er, I get an AssertionError but yeah I'm having trouble specifying the arguments
 
in my code ?
 
Yeah
 
I just wrote that from memory, can't actually compile to check
 
12:14 PM
Ah, got it. Although I really don't know how you would define functions taking more than 4 arguments...
D:GHbR-+GHb:4 5 6
 
that's not possible
 
@Sp3000 please do!
 
45 bytes and can probably golfed a fair bit, possibly with a better approach
@Lembik Ahaha k will do then - do you already have an answer? Out of curiosity
 
@Sp3000 no!
 
so we've got Mathematica, Pyth, Python and JS now? ^^
 
12:26 PM
Python and Pyth count as 1 :P
 
yeah, I thought so
 
(I don't like posting separate answers when it's just a port)
 
depends... if it's a port from Python to Pyth, no
but if it's a port from Mathematica to CJam (or vice versa) I'd post two answers
 
@Lembik Do you have any examples btw? 50%/20% is a pretty hard cutoff to satisfy in my mind
Yeah I'd do that too, but Python -> Pyth :P
 
yeah, that's fine
@Optimizer are you working on CJam or should I just post and hope for the best? ^^
 
12:29 PM
Give me a bit more time to see if I can work out Haskell
(Hint: I'm terrible at Haskell)
 
you can Haskell?
 
Just what I know from the uni assignment last semester (aka not much)
 
oh, there's someone who could add golfscript to the mix :D
 
Oh I know how I should be doing this in Python, silly me :P
 
I am in a meeting
so no cjam
 
12:39 PM
@Optimizer then why are you even in chat? :D
 
tab is open
 
@MartinBüttner Can I specify which list is inputted first?
 
That makes things shorter :)
 
yeah changing the order of arguments often helps in Mathematica too
 
12:46 PM
I just means I can print and call the function at the same time
I think I'm ditching Pyth, I like my new Python solution too much to post a Pyth one
 
haha
how long is it?
 
73 bytes
 
and if you ported it? :P
 
It uses iter, which I'm not sure Pyth has (I've never figured out how to use Python in Pyth)
It'd probably be shorter anyway with some workaround
Nevermind, got another approach. I'm porting.
 
i got the hat, but no idea which message was starred
its not even showing on the right
 
12:52 PM
it is for me ;)
23 hours ago, by Optimizer
user image
 
ah thanks!
 
it's the bottom-most starred message for me
 
so post ur question in an hour ?
 
but the length of the list might depend on the window resolution
 
i dont have it. bottom most is SE one by sp3000
 
12:53 PM
@Optimizer yeah, roughly
hm I've got two more
 
I think Pyth can be about 30 or so bytes but I cbf debugging right now
 
cbf ?
 
can't be bothered
except with a different verb
 
oh
what is f then ?
 
well... the different verb :D
 
12:59 PM
wtf f ?
 
yes ^^
 
we are not kids here, I think
you could have said that :P
 
I should really use cbb, not sure why I use cbf instead
 
I'm not sure if chat has autoflags :D
 
@Lembik Random string generation's turning up nothing :/
 
1:00 PM
also there are kids in here :D
 
there are ?
who ?
 
if you consider 13 year-olds kids...
 
still who ?
 
oh, they're actually 14 and 15 now
Doorknob and cjfaure at least
 
@MartinBüttner Awkwardly, my code's shorter if I take one list as STDIN input but the other as function argument... I'm guessing that's not allowed? :P
 
1:01 PM
@Sp3000 nope, I mentioned that explicitly ^^
 
Thought so :P
I don't get how to check types in Haskell easily, so I don't think I'll be doing that :/
 
@Sp3000 :(
 
:(
 
@Sp3000 is it easier if one string is longer than the other so you don't need to worry about cyclic shifts?
 
Hmm I think it's more the 50%/20% and ten shifts
Probability-wise I'm not sure what the chances of hitting a case that fits is
 
1:15 PM
@Sp3000 well it would be interesting is one exists!
if one
 
I'll try less rotations
 
fewer :)
 
@MartinBüttner Porting my nested solution would be easy if Pyth had a pop which actually worked like a Python pop
@Lembik Well corrected :)
 
@Sp3000 heh...
 
I like my solution anyway :) it's on 68 now
(Python that is)
@Lembik Even 2 rotations is given my program a hard time. 1 is pretty trivial though
 
1:24 PM
interesting
 
Do you have any examples?
001111000011100
100001110001111
^ It found one for 2 rotations
 
@Sp3000 hmm.. I will try to make some
I don't have any here sorry
that's a nice example"!
 
doorknob is a kid :O
7
 
and an interesting potential pattern
 
001110000011110
000111111000011
also
000110000111000
110011100011111
Weirdly they have the same length and I can't tell if that's coincidence
Oh, happy new year - it's half past 12
 
1:33 PM
lol how did you miss that?
 
Too busy golfing
@MartinBüttner If we write a function, can the function destroy the values list?
 
sure
time to post it I think
 
:) k
Not gunning for pizza?
 
we'll see
 
I can defs do the JS one right now.
output as a returned array is fine ?
@MartinBüttner ^
 
1:43 PM
yes
 
kewl
post it
I'll start on cjam in the mean while
meh
 
0
Q: Unflatten an Array

Martin BüttnerThis challenge was inspired by a question on Mathematica.SE. Say you've got a nested list/array of some arbitrary structure (the lists at each level don't necessarily have the same length). For simplicity, we'll assume that the nodes are non-negative integers or empty arrays. As an example [[[1...

 
you could have waited for a bit before posting your own solution
 
I thought the point of posting that one was to rule out copying from Mathematica.SE?
 
if you are giving credits to someone else, make it a wiki answer ? (but maybe after 30 minutes)
should have waited for 30 minutes. what if wiki answers dont count ?
 
1:52 PM
@Optimizer already did
@Optimizer hm, maybe... well
 
I know
 
@Sp3000 yes?
 
(that was a reply to Optimizer)
 
so , only 2 (or 3) answers to go
 
damn that Ruby one is good
@Sp3000 oh
 
1:54 PM
@so
@Sp3000 ok I have a harder version :)
 
@Sp3000 :D
boom HNQ :D
 
That was fast
 
ugh, C# doesn't allow arrays/lists that contain both other lists and integers
 
@ProgramFOX not even as objects?
 
oh, forgot about that. Thanks!
That's going to become looong code :P
 
2:00 PM
@ProgramFOX can you use the try/catch trick from Ruby?
 
"As long as it's within 16 minutes," thinks Martin, as he watches over the HNQ
 
@MartinBüttner I don't think C# has a built-in Shift method that works like that.
 
@ProgramFOX I don't think that methods depends on the unshift
 
I wish try/except and return were shorter in Python or I'd have done that :/
def g(N,L):
 def f(N):
  try:return map(f,N)
  except:return L.pop(0)
 return f(N)
 
oh yeah, that return...
 
grc
2:05 PM
happy 2015 everyone :D
 
Happy 2015!
 
:D
 
Happy 2015 :) one timezone at a time
 
@MartinBüttner got hat ?
 
there's only one real time zone
 
2:05 PM
more than 3 timezones have it right now
 
@Optimizer not yet, they take a bit
@Optimizer I don't think my self-answer counts tbh
 
@grc nice one!
 
grc
@Sp3000 actually I'm just over an hour late
 
@Optimizer how do you split a CJam array on multiple elements?
 
@grc Also same :P 1am here
 
grc
2:06 PM
did you watch the fireworks?
 
Yup
Man, I keep forgetting that numbers are smaller than lists
That would have been better
Also that list comp instead of map :/ I feel silly now
 
@MartinBüttner its hard
recursive answer in a stack based language :D
 
I've got 24, but it's also string manipulation (but without using regex)
 
these empty arrays represntation like "" bit me
 
@Optimizer why is that a problem?
 
2:16 PM
if it was represented like [] only, then the code would be '[#~ but now it is "[\""&
 
aaaaand top of the HNQ :D
and 30 minutes are over
 
got hat ?
 
not yet
patience
maybe the answers need to be from 5 different users (not counting myself) though
 
I have a question idea myself but I'm not sure if it's been done yet: Given a permutation, find the next one lexicographically, wrapping back to the first permutation if the input is the last one
 
@Sp3000 if anyone can tell you it's @Peter ;)
@Optimizer got it
thanks guys :)
 
2:20 PM
nice!
i hope you remember this for my question this week :P
 
Fun, my first C# attempt gave a StackOverflowException :/
 
@Optimizer sure ;)
@Optimizer now go and beat 24 ;)
 
well, you should have banned string manipulation
as it is question
double standards :P
 
then how would you have determined the type? :P
 
my JS one does not do string manipulation at all
and so does the CJam one
 
2:23 PM
what's the backticks then? :P
 
its not manipulating :P
just stringifying then set operations
 
lol
talk of double standards...
 
no manipulation happening :P
 
Okay, at least my C# code doesn't give errors anymore! Now checking the correctness... :P
 
2:39 PM
0
A: Sandbox for Proposed Challenges

Sp3000Next Lexicographical Permutation code-golf array-manipulation Not sure if this has been done before so I thought I'd post here first Given an array representing a permutation of the first n >= 1 nonnegative integers, find the next lexicographical permutation. If the input was the last possible ...

 
Well, running another array gives an error again :/
ah, used a wrong variable name
The structure of the result already seems okay, but the values are incorrect.
 

« first day (1432 days earlier)      last day (3429 days later) »