Tell me more ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

What are some tips for choosing the right language to golf? What factors affect the language to be chosen?

Here are some example problem types:

  • Problems that require I/O solution, either console or file
  • Problems that require parsing
  • Problems that requires you to write your solution as a function definition
  • Math problems
  • Problem dealing with prime numbers
  • Solving number puzzles
  • Performing numerical methods
  • String processing
  • Array processing
  • Tricky 2D array problems
  • Computational geometry

Don't simply say things like "Use GolfScript|J" because you like them

share|improve this question
For some problems it's the type system. E.g. if you need to deal with integers greater than 64 bits, you want languages which have that built in (e.g. Golfscript, Haskell) rather than languages which make them expensive (e.g. Java). – Peter Taylor Apr 16 '11 at 21:02
I've made this a wiki in keeping with our policy on "Tips" type questions. – dmckee Apr 16 '11 at 21:13
99 bottles is helpful if you need a language beginning with a specific letter... – Jesse Millikan Apr 19 '11 at 4:24

2 Answers

up vote 1 down vote accepted

Depends on what one needs, C/C++ is fast, but you have to code more of the work yourself. Python and Ruby are slower but are a lot easier to code with built in methods that shortens a lot of work and they automatically handle infinitely large values (if one has the RAM). Using a functional language like Haskell is great for purely mathematical functional use if one can frame the problem that way.

share|improve this answer
As a primarily python user, in Py you pay for your ease of use in character count although there are some really hacky tricks which can save characters. Haskel and Lisp, while fun, tend to run even longer than Python. – rmckenzie Jul 2 '11 at 4:48

I think C++ is a great choice, it has quite many many users, and it has also many abilities and potentials. There are some pre-coded data structures in the STL. Choosing others like Java and Pascal is also great. So a combination of C++ / Java / Pascal is perfect!

share|improve this answer
2  
Wasn't the question What are some tips for choosing the right language to golf? – mbx Jul 1 '11 at 20:21
I don't think that the amount of users/developers using a language is a relevant criteria for its usefulness in code golf challenges. The question describes some specific problem types, could you perhaps elaborate on which of your suggestions may be a good choice for which problem type? – air_blob Nov 20 '12 at 9:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.