« first day (1624 days earlier)      last day (3213 days later) » 

1:41 AM
I linked this to aditsu over IRC some time ago, and I'm not sure if he ever saw it. Ah well. Here's a nice CJam cheat sheet I made that you might all like.
It's a bit terse (like CJam, perhaps!) but it mostly contains the things I keep needing to remind myself of when writing CJam, so there's that.
 
@aditsu @Mauris I received it and posted it here
 
Aha, cool!
 
I tried to reply on irc but it said "no such user", anyway, thanks a lot :)
 
Well, feel free to put it on the CJam website, or something, if you think it's a useful resource!
 
alright, will do
 
1:44 AM
Maybe I should specify that it's for 0.6.5, though
 
@Mauris Can you make one for GolfScript and/or Pyth?
 
@Phase That sounds doable. GolfScript is almost a subset of CJam, anyway
Don't know about Pyth, haven't ever tried it out
 
@Mauris I don't think I've seen any CJam code written by you :)
 
That's right! I've only hacked at it a bit "locally". It's pretty popular for every problem, though, so usually other users post really short CJam answers before I get the chance to :<
It's fun, though; feels very much like GolfScript, which I've done a fair bit of golfing in
anyway, I should go to sleep @_@ @aditsu: I've updated the pdf to have the version number at the top!
 
ok, thanks
 
2:44 AM
@aditsu Are you still here?
 
no
 
OK, nevermind then. :P
I found a 31 byte version of your code.
 
wowza
 
And it's faster too. 1.2 seconds for all test cases, firing up the JVM for each one.
q~L{_:&\f{_2$f#:).>j+}{,}$W>s}j
 
O_o
 
2:50 AM
aah, the empty case was costing so much??
 
Well, the whole _:*{}{+&}? isn't needed anymore.
I put all cases in a test suite to fire up the JVM only once. 0.378 s real time and 105,832 KiB peak memory usage.
 
oh, the :& is also crucial
 
@Dennis This language is wizardry. I must learn it.
 
@Dennis the ~ feels a bit like cheating, but if you say it's legit, I guess I can use it :p
only 1 byte anyway
 
The Pyth answer does the same. Also, it says explicitly in the question that it is allowed.
You may read those strings as an array of strings or a single string with a delimiter of your choice.
 
2:57 AM
I hope this latest version won't end up translating to 20 bytes in Pyth :p
 
There's always that chance...
 
>_<
hmm, I'm somewhat surprised that W> works with the empty string...
 
@Dennis "fire up the JVM"
 
Well, what can I say...
 
ah, it acts as "before -n" so gets clamped to 0
 
3:06 AM
The test case with two strings is now the slowest. It works in the online interpreter, on my phone!
@aditsu I'm running the test cases again, without memoization. All but the one with two strings finish pretty much instantly. That one is still running.
 
I love the way Argh! prints: esolangs.org/wiki/Argh!
 
Broken link. You have to escape the !.
 
3:28 AM
@Dennis a bit sad that we need the s
but over all, it's awesomesauce :)
 
It is. How often does your code get faster by making it shorter?
 
 
1 hour later…
4:53 AM
wtf, google decided that this is the next song in my mix: youtube.com/watch?v=bS5P_LAqiVg
 
Are languages like GolfScript, CJam, and Pyth considered high-level or low-level languages?
 
High-level.
 
some of the highest :p
 
Their commands don't deal directly with memory structures or anything; the stack can hold many different datatypes at once...
You can apply complex functions to whole arrays or strings, or run those languages on any machine without noticing, etc, etc.
There's abstraction everywhere.
 
5:09 AM
omg that movie is pretty cool :p
YOU'RE ABOUT TO HACK TIME, ARE YOU SURE?
>YES NO
 
its not a movie
Kung Fury
 
:O is it... real?!!!
 
>YES NO
 
5:35 AM
YOU ARE ABOUT TO HACK REALITY, ARE YOU SURE?
> YES NO
 
 
1 hour later…
7:01 AM
shouldn't sed change all occurrences with s/.^H//? why does this work?
9
A: Backhanded^H^H^H^H^H^Hspaces

Digital TraumaGNU sed, 11 bytes :;s/.^H//;t Test output: $ echo "Horse^H^H^H^H^HCow Be nice to this fool^H^H^H^Hgentleman, he's visiting from corporate HQ. 123^H45^H^H^H78^H Digital Trauma^H^H^H^H^H^H^H^H^H^H^H^H^H^HMaria Tidal Tug^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HDigital Trauma" | sed ':;s/.^H//;t' Cow Be nic...

 
@randomra I guess it needs /g to change all
 
Fixed my bug.
3
A: Emulate an Intel 8086 CPU

luser droogC - 319 lines This is a more or less direct translation of my Postscript program to C. Of course the stack usage is replaced with explicit variables. An instruction's fields are broken up into the variables o - instruction opcode byte, d - direction field, w - width field. If it's a "mod-reg-r/m...

 
For once, I thought it was Dennis
 
@aditsu thanks for this, the next clip from there is a David Hassehloff song clip (from that movie I guess), which is fantastic
 
Lots of circle heads in here for sure.
At small size, Geobits is one too.
 
7:15 AM
@aditsu right, the sentence "s: The substitute command changes all occurrences of the regular expression into a new value." fooled me. I guess it meant per line.
 
A global replace wouldn't be enough anyway; it needs to recurse
 
@feersum it would work at all with global, abc^H^H^H would become ab^
 
that's what I'm telling
 
ok then :)
 
8:05 AM
haha! just dropped a code bomb in comp.lang.c
 
@xnor I have an idea for backhanded in Python but I'm not sure how best to do it :(
(based off my alternative)
 
eval you mean?
 
Yeah
I just tested, and "a""b""c"[:-1][:-1] actually works, so I need to map ^H -> [:-1] and any other char c to "c"
 
they didn't like my macros. so I removed them.
 
@Sp3000 that's clever and funny
 
8:07 AM
I thought you were intending it like another one of those questions-inspired-by-golf-tip questions :P
 
nope, I don't have anything up my sleeves
this time :-)
your answer is shorter than anything I had
 
    'H''o''r''s''e'[:-1][:-1][:-1][:-1][:-1]'C''o''w'
                                              ^
SyntaxError: invalid syntax
:( I guess I can't have strings after it...
 
oh darn
and + wouldn't group right
 
Yeah, hence the parens in my eval currently :/
It's also pretty annoying that importing re and such ends up at 60+
 
i'm happy about that :-)
so many langs are just using re
 
8:12 AM
the first thing i thought of when i saw the ^H challenge was "Now is the time for all good men to come to the aid of their party. I^H Because I would not stop for death he ^H^H^H^H^H^H^H^H Death he kindly stopped for me. Red Sky in Morning Sailor take e^H wArning."
i'll be impressed if anyone knows where i took that from ;)
 
(Hmm if strings were mutable o[-1:]=x would be nice, but they're not)
 
heh, I found a cute CJam solution in that spirit: q''f\"'^'H"/';*~
(too long though)
 
does the ~ make it cute ?
I want to know so that I can make my answers cute too!
 
mostly the f\
 
What's cute in that ?
 
8:25 AM
\ returns 2 values
 
3 days in and is still not a thing ... We sure are obedient ..
5
 
Same length: Lq"^H"/:"+W<"*~`
Hmm yeah I don't think eval's going to end up beating anything, unfortunately :(
I like it when it does though
 
9:13 AM
@Optimizer don't we at least have a question about the overhand shuffle? I could write one :p
 
9:37 AM
ah, there's an overhanded challenge in the sandbox
 
is there ?
 
2
A: Sandbox for Proposed Challenges

GeobitsOverhanded (Underhanded) Poker king-of-the-hilloverhandedcard-games Also if you make overhanded a thing I'll whack everyone involved with a large trout ~ Doorknob You and your poker buddy are bored, and seeking to liven up the usual poker game. Playing one hand just isn't challenging any ...

5
 
9:55 AM
haha
geobits!
 
That's what we were talking about the other day :P
 
10:11 AM
Now it looks like it has been 23 days in
 
I'll post something else later :) (busy atm)
 
No, I mean, because of the star count
 
Only if you're using PARI/GP
 
@Optimizer ah ok, but I was not responding to that
 
10:41 AM
0
A: How to move questions from the Sandbox

trichoplaxAdd a random sandbox post feed to drop a oneboxed link into chat once a week This was hinted at in chat so I'm adding a place for people to vote on it. I'm imagining this being maybe once a week. Raising a sandbox post in chat generally results in more feedback and more chance of the idea either...

 
 
4 hours later…
3:04 PM
Hi, this is my first time on this community. Do you guys mind talking about interview questions?
 
Heya! In chat, we're pretty lenient with what we talk about. What's your question?
 
do they ask code golfing questions in interviews? that would be cool :p
though not necessarily useful
 
@aditsu you can always golf your answer. results may vary
 
haha, if you pass, it could mean job security
 
that aspect of programming always disturbs me...
job security by golfing
 
3:12 PM
Wait, people actually do that?
 
we might have an answer for do you golf for a living :)
 
no idea, but if you can imagine it, there's a chance somebody is doing it
 
@BrainSteel not golfing, but writing hard to read code, sure
 
That rubs me the wrong way...
 
3:39 PM
Cool, Just double checking. Also it's not exactly a code question.
But, is there a standard solution to the "bridge crossing problem" or the "river crossing problem" or do you just have to think it out.

Bridge Crossing:
you have 4 people, 1 flashlight, and a long bridge on a dark night that can only support 2 people at a time. In order to cross the bridge you need the flashlight to see where your going. The people walk take different speeds to cross the bridge, and you always walk across the bridge at the speed of the slowest person.
one person takes 10 minutes to cross, another 5, another 3, and the last one takes 1 minute to cross
What's the shortest amount of time you can get all four people across the bridge
basically, how should I approach the problem? I've come up with answers to it before, and I've read answers to it, but I haven't seen a good explanation for how you can systematically get to the solution.
 
This looks like a question that is currently sitting in our sandbox. I don't have much experience with this particular problem, and it seems pretty interesting. I'd be interested in a good approach too.
 
exactly!
I feel like it's one of those interview questions that kinda suck: brain teasers
and just require some little trick, or require you to know the solution ahead of time
which just seems silly to me, and non-constructive for interviewing
 
I feel like there's got to be a clever way to do it. Writing a program that can choose when to make two slow people walk at the same time to save total time is challenging. Once (if) that question is posted to main, I'm sure we'll see some good answers :D
 
Is there a protocol for posting to main?
I should probably read the FAQ/rules for this community
 
one way to solve it is to make a graph of possible situations with transition lines between them, then you just need to find a path between 2 vertices
wait, maybe it's a different type of problem
 
3:53 PM
and there are only 2^4 * 2 = 32 states
 
since I see something about time too
 
and you need the shortest path
 
still, you can use a graph to model it
 
@wtyneb It can be hard for new people to post good challenges here, since there are a few things that the community expects of questions. I would highly recommend reading our rules and FAQ. Also, you shouldn't post a question from our sandbox unless it is clearly abandoned and without asking permission of the original author, as a general rule.
 
@aditsu think you'd end up with essentially a tree structure, not so much graph-like no?
 
3:55 PM
there can be different ways to get from one situation to another
 
For only four people, it's simple enough to bruteforce the problem, but that is by no means elegant.
 
yeah, I was thinking of a more generalize approach, interviewers think you're dumb when you try to brute-force
 
about posting, I recommend answering some challenges first, to get a feel about how they're written, and get some reputation too :p
 
Very true! Although, I think I'm more interested in the approaches to solving these small programming problems, rather than creating the smallest solution.
more of a discussion, than a contest
I know StackOverflow isn't a good place for these kinds of questions, but codegolf looked to be a better fit
Does anyone know of a better community for that kind of discussion/learning?
 
If you're looking for novelty rather than brevity, you can find some amazing approaches in problems, problems, or problems. Also, a lot of the code-golf problems have really unique solutions too, they may just be harder to find :D
 
4:03 PM
Yeah, I feel like codegolf relies more on iterating your solution. That is, getting an answer that works, then try to shrink it down using language constructs
 
It's a different form of cleverness.
 
I guess the other issue I have had with interview problems, is running out of time, where I have the right approach, but I just run out of time. Or I get frustrated because of the pressure or some other bullshit (like having to code on a piece of paper the size of a postcard).
@BrainSteel yeah, I definitely like codegolf
 
@wtyneb If the company is giving you brainteasers you might want to reconsider the company :P
 
truth!
This was with Bloomberg that they were being pretty annoying
 
Have you tried timing yourself with finding answers to Google Code Jam problems? They're usually very good training for this kind of thing.
 
4:07 PM
really cool company, with smart people, but I've interviewed there twice, and both times it was made more difficult by factors having nothing to do with the problem they posed
@BrainSteel I'll definitely have a look
 
The alternative is to read up on the common silly questions, then put them on the spot with "Ermm... I've heard that one before sorry" (Disclaimer: may not be good advice)
 
There are a lot of practice problems on GCJ, and if you decide to compete next year, they usually have pretty strict time limits to solve 3-4 quite difficult problems. The PPCG community had a little group of people compete this year, it was pretty amusing.
 
who's PPCG?
 
PPCG is the abbreviation of "Programming Puzzles & Code Golf"
 
Thanks
 
4:54 PM
if there are a finite number of human-understandable and human-conceivable programming challenges, I wonder how long would theoretically be before we can't come up with any more challenges
 
Hmm, I wouldn't say there are a finite number, or if it is finite than it's extremely large. I mean if a problem can be defined using any arbitrary space, then we could continually create larger more complicated problems that need to be solved.
Also, if we keep creating new languages, or higher levels of abstraction, or if computers are able to solve new kinds of problems in the future (maybe quantum computers?), then we'll keep increase the space of things that can feasibly be solved.
 
5:13 PM
0
A: Sandbox for Proposed Challenges

aditsuAnalyze overhanded shuffles overhandedcard-gamescode-golf Rod is moderating a card game between two players: George and Tim. Currently, Tim is shuffling the cards. Rod suspects that Tim is trying to cheat, so he needs your help to check that the shuffle is fair. Tim is doing the overhanded shu...

6
 
@Optimizer ^
 
This is the greatest tag ever.
 
5:29 PM
@Doorknob ^
 
damnit
someone bumped a very old question
I want to submit a marbelous solution
but it predates marbelous :(
I might do it anyway and just post a disclaimer?
 
it doesn't predate golfscript :p
 
0
A: Fibonacci Sequence Generator

SparrMarbelous post-dates this question, but since I made recursive fib(n) the canonical example of the language in the docs for my interpreter, I thought it worth posting: :Fb }0 }0 }0 .. # three copies of the first input, call them A B C -- &0 >1 {0 # decrement A, hold B, return C if it's <2 &0 -- >...

 
 
1 hour later…
6:39 PM
@Sp3000 Writing a new language that's 1D, should numbers be only one character (up to 9 or maybe more with letters), or have spaces in between the numbers.
I'll do one character number and have it go to 20 like CJam
 
7:06 PM
@Dennis Hey, you're really good at CJam. FYI.
 
why 20 instead of 36?
 
@AlexA. Thanks. What made you say that?
 
7:30 PM
@Dennis Nothing in particular. Just wanted to give recognition for impressive abilities.
I'm always impressed by how talented everyone on PPCG is.
 
7:52 PM
@Sparr I meant 36 :P
 
@AlexA. You also have a very unique talent
 
@Optimizer is it knitting?
 
no
but close
 
@AlexA. I know what you mean. I'm usually blown away by fastest-code challenges. In part because I don't know how to write fast code. :P
 
@NewSandboxedPosts ahahaha
I like the trout reference, @aditsu :D
 
8:48 PM
I need some challenge inspiration.
 
@Calvin'sHobbies Make one using the top 5 non-mutually-exclusive tags on this site.
 
@Calvin'sHobbies do you need 2 random words? :D
 
@Calvin'sHobbies "challenge" and "inspiration"
 
@Calvin'sHobbies Poincaré disk model tesselation.
 
9:19 PM
I've modified an existing solution by adding one operation to it and gotten a much better score at the challenge in question. I am not comfortable submitting a separate answer for such a small change :(
I guess I'll comment, let the original author add the change, and expect/predict they will credit me?
 
@Optimizer Is it a superhuman ability to make smart-ass comments?
@Calvin'sHobbies What's your favorite meal? Perhaps something related to recipes. Maybe I'm just hungry...
 
9:52 PM
Too much inspiration...
Y'all should come play Minecraft
 
@Calvin'sHobbies I might sign on in a bit
 
Help me kidnap a baby villager
 
10:10 PM
Haha
 
10:29 PM
0
A: Sandbox for Proposed Challenges

jimmy23013(Need a title.) Write two programs (or functions) in the same language for these two tasks: Given a list of integers, split at every non-negative integer. If there are two or more consecutive non-negative integers, your program should preserve the empty list between them. Given a list of lists...

 

« first day (1624 days earlier)      last day (3213 days later) »