It is my understanding that this new Mathematica.SE site is to be an umbrella for all things Mathematica, including questions that would otherwise belong on CodeReview or CodeGolf for example.

Is this understanding correct or are Mathematica questions to remain scattered across various SE sites if they do not fit the model of the tag on StackOverflow?

For those who don't know: "code golf" is a game of trying to write a particular function using the shortest possible code. Code review simply refers to asking for critique or refinement of existing code.

  • I did not know what code golf was until recently. I thought it was about general puzzles, not about code length. One needs to click through to the site, go to the FAQ, and read carefully to realize that the aim is to come up with the shortest code. – Szabolcs Jan 25 '12 at 20:22
  • @Mr.Wizard I find interesting code golf category questions, but let's say once or twice a week, not too many +1. – Artes Jan 26 '12 at 11:57
  • @Artes, I think once or twice a week is too often. Monthly, or quarterly, is much better. – rcollyer Jan 26 '12 at 14:06
  • @rcollyer Don't be so averse, if there are 200 questions in one week, one or two code golf don't harm too much. You could avoid anyway code-golf tag. – Artes Jan 26 '12 at 16:55
  • @Artes if we get to that point, sure. But, on SO we were up to 40+ questions per week, so no where near that level. – rcollyer Jan 26 '12 at 16:57
  • @rcollyer If there are only 100 it's all right, look there are 190 qestions after only one week. – Artes Jan 26 '12 at 17:11
  • 1
    @Artes, several of us, myself included, stored up a bunch of questions prior to launch. Let's wait and see what the question rate settles out to before we make any judgements based on ask rate. – rcollyer Jan 26 '12 at 18:12
  • 2
    I vote up for code golf! – Dr. belisarius Jan 30 '12 at 22:29
  • 1
    Personally I think that it can be very valuable to get answers to code review questions. Sometimes I very much wish someone looked over my code. So I'm leaning towards wanting to allow questions like this (and creating a new tag, code-review). However, I'm not sure how well these questions will fit the site (there's potential for abuse), and I'm not sure how people will feel about answering them or how good the answers will be. – Szabolcs May 9 '12 at 12:21
  • 2
    I agree, but (as per my answer) we need to encourage users to be specific about what they think of as an improvement. Given Mathematica is sometimes difficult for new users, it would be good to encourage people to become more familiar with good Mathematica coding style, and requests for directed code-review (i.e. with specific goals) would definitely be able to help. Perhaps we could create a tag: [tag:what-would-Leonid-or-MrWizard-do?] ;-) – Verbeia May 9 '12 at 12:53
  • In your view is a question like "here's my code, please find the bug" also a code-review question? – Sjoerd C. de Vries May 9 '12 at 15:21
  • @Sjoerd No, that's not a code review question. A code review question is something like this: "Here's my code. It does work correctly (as far as I can tell). But I'm a beginner and your feedback/comments on how I solved this task (see attached not-too-long code) will probably improve my Mathematica skills. So any feedback is welcome!". Or it can be a bit more specific as Verbeia said. – Szabolcs May 9 '12 at 15:36
  • I like code golf. Even better -- can we get all code golf responses stored where on github? I'd like to have copies of all code golf questions / responses in a single accessible repo (instead of having to hunt them down one by one.) – user1602 Jul 14 '12 at 10:24

I too agree with David that code-golf questions should be off-topic. I personally do not find extremely terse code useful. The few gems that some of those answer might turn up might be better appreciated in a normal answer.

Also, given the voting nature of the SE platform, it is hard for someone who is a week late to the party and manages to shave off 3 characters from the best solution thus far to catch up in votes precisely because people have lost interest at that point. Also, if this becomes a recurring pattern (and it will, as it did on SO, which is why a new site was created specifically for that), it will only diminish the value of this site. It is easy to say that we won't let it become a pattern, but who's going to be the arbiter of how frequent is too frequent?

I admit that I do, however, learn a lot from the submissions to the annual Mathematica nifty function in 140 char or less competition. I really think that something like that would be great for our blog (once we're more established and have content to sustain a blog). We can probably run a monthly/quarterly competition in a similar vein and let the users vote on the best solution. This also automatically takes care of the "too many questions/too frequent" complaint.


I don't think golf is appropriate for a site that is supposed to help others, as the code posted in answers is of very little use to anyone (possibly excluding the poster himself).

In addition, even if a code golf question is popular, the structure of this forum doesn't really allowed coherent discussion: the codes can be too long to be posted in comments, and posting an answer ("I improved your code, Mr. Other Answer") is also not a good idea since upvotes can change the order of posts.

  • 3
    Unless it becomes a problematic pattern, I disagree. I feel that "golf" and other challenges can teach people about aspects of the language, and can be fun at the same time. – Mr.Wizard Jan 25 '12 at 20:15
  • 1
    Solving them yes, but not reading the code. It's more a matter of decyphering than actually learning something. Also, learning is a bonus for golf questions, but not really what it's about: a funny programming riddle. – David Jan 25 '12 at 21:48

I think code review questions should only be allowed where the asker has been specific about how they are looking to improve the code, e.g. faster (anything in the performance-tuning tag), more functional style (e.g this question of mine and anything in the functional-style tag), more concise/readable (would be tagged with the coding-style tag).

I think these types of questions are generally already covered with existing tags.

  • I think a simple rule of thumb could be — "if I have to scroll to see your code fully on the site, then it is too long". :) But I'm on-the-fence on CR questions, as the potential for abuse is high and more often than not, CR questions require you to understand their subject. I'd much rather they recognize troublesome/inelegant parts and break it down and ask how to improve certain parts (like your question example above) rather than ask us to go through the whole thing to fix it. – rm -rf May 9 '12 at 15:01
  • @R.M What do you think about the (now deleted) question I linked? I don't think it's too long (given its nature---lots of options). – Szabolcs May 9 '12 at 15:38
  • Code length should be a criterion. I agree with @R.M that it ought to be less than a page. Preferably the scroll bars should not appear. And users should not just dump code. As always, they should show some effort. In this case, explaining what the code does, how it does it, and what kind of improvement is sought. – Sjoerd C. de Vries May 9 '12 at 16:00
  • @Sza [1/2] I would've voted to close that one. CR is in some ways like going to a (free) car mechanic... If you tell him that you think your brake pads are worn out, then he'll check that and fix it. On the other hand, if you just drop the car off and ask him to first find whatever is wrong and fix them all — he'll probably give it an extremely low priority, since there are others waiting who know what's wrong. Coming back to the CR, I think a good example is your question on finding elements in a sorted list. Runnable code was there, you had a clear criterion for "improvement" (speed)... – rm -rf May 9 '12 at 16:01
  • @sza [2/2]... and the title was something that was easy to search and is useful. Even Code Review insists on focusing on the specific problem at hand (e.g., Am I using too many Tables? Can I inline functions like this? Can I blah like that... etc). That way, eventually you can close the review questions as duplicates of these older ones (even though the code is different, the concept is the same) – rm -rf May 9 '12 at 16:03
  • ndroock's question does not satisfy these... I rewrite titles a lot, and yet I don't know how that could've been reworded usefully without actually reading and understanding the code in detail. Also "comment on my style" is not particularly useful. Perhaps it could've been started in small steps in chat. Or break it down to a simple example and ask for general tips to avoid (or refactor) code duplication – rm -rf May 9 '12 at 16:12
  • 1
    @R.M To put it concisely, the thing about these unfocused code review questions is that I want to ask them myself (+1), especially when I'm learning something new, but I don't want to reply them (-1) and I'm not likely to be interested in others' answered questions either (another -1). – Szabolcs May 9 '12 at 17:20
  • 1
    @Szabolcs I think with that last comment you've hit the nail on the head. IMO, code review questions are on topic in the abstract (if not: isn't this contrary to our goal of being a very general site for all Mathematica-focused questions, and where else would they be more appropriate?), but only to the extent that they aren't "too localized" (i.e., the code itself or discussion of the techniques used to improve it could be useful to someone else later on). – Oleksandr R. May 9 '12 at 20:20
  • 1
    @Szabolcs Obviously we're not trying to be a consultancy service, though (there are others who do that for a living), so I'd suggest that it's okay to ask these questions in almost all cases, as long as the askers understand that boring/overly demanding/excessively narrow questions might be closed rather than answered. – Oleksandr R. May 9 '12 at 20:30

I think it would provide a vivid diversity for the M-community. Mathematica is known for its ability of a terse coding, sometimes being even a kind of fine arts. However one condition should be obligatory: not too often.

  • 4
    I agree, I am a big fan of the Mathematica one-liner competition, and I would like to see that kind of sport alongside Q&A. – tlehman Jan 26 '12 at 2:52

The Wolfram Tech Conference has a yearly 140 chars one-liner competition with truly amazing entries. Some are really eye-openers. Some are extremely funny. You can really learn from them. I wouldn't like to call those off-topic and by association other code-golf entries. I do hope that they won't make up a significant portion of the questions, though.

  • Didn't notice Tobi's comment before posting this. One problem with this "not too often" statement is that it is rather arbitrary. How would you police that? – Sjoerd C. de Vries Jan 26 '12 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .