35
\$\begingroup\$

I'm sure many of you want to attract golfers to compete in your favorite language. Given that it takes time to learn a language for golfing, why choose it over others? What aspects of the language make it fun to golf? What skills or mindset do you gain? Please be specific and concrete.

Any language is fine to recommend: well-known, esoteric, community-made, and so on.

\$\endgroup\$
  • 13
    \$\begingroup\$ Waiting to see how Geobits will manage to advertise Java… \$\endgroup\$ – Fatalize Jul 20 '16 at 10:06
  • 13
    \$\begingroup\$ @Fatalize: "Never have to worry about whether you'll be outgolfed again!" \$\endgroup\$ – Deusovi Jul 20 '16 at 11:49
  • 3
    \$\begingroup\$ PowerShell is great and does all things. \$\endgroup\$ – AdmBorkBork Jul 20 '16 at 13:59
  • 15
    \$\begingroup\$ @Deusovi That is one of the things I like about it, tbh. Unless those dirty C# golfers show up. Then it's on. \$\endgroup\$ – Geobits Jul 20 '16 at 17:47
  • \$\begingroup\$ @Geobits Consider it on ;) \$\endgroup\$ – JustinM - Reinstate Monica Jul 25 '16 at 23:46
  • \$\begingroup\$ @Geobits (^: dirty java programmers have to be outgolfed for the sake of glory \$\endgroup\$ – downrep_nation Jul 31 '16 at 18:06
  • \$\begingroup\$ Do we really need this here when we have Showcase your language one vote at a time on main? \$\endgroup\$ – Mego Sep 2 '16 at 7:31
  • 5
    \$\begingroup\$ @Mego I think they're quite different. This isn't to list cool features of your language, but to explain why they are good choices to learn to golf. Some of the answers do mention cool features, but also a lot more. \$\endgroup\$ – xnor Sep 2 '16 at 7:34
  • \$\begingroup\$ The discussion tag has the goal of "reaching community consensus" on a topic. This question is primarily opinion-based. VTC. \$\endgroup\$ – mbomb007 Mar 7 '17 at 22:29
  • \$\begingroup\$ I would say the title should be "Advocate languages to be used in PPCG contests". Not all contests are about golfing. \$\endgroup\$ – Weijun Zhou Mar 14 '18 at 4:24

23 Answers 23

32
\$\begingroup\$

Java

Java may be verbose, but don't we golfers come to PPCG to have a challenge? Don't we come here to do what was thought to be impossible? We golf not because it is easy, but because it is hard.

Winning in Java may not be easy, but succeeding means receiving supreme glory (i.e. upvotes).

And if you really want conciseness, go use Kotlin.

Darn Kennedy stole that line from me...

\$\endgroup\$
  • \$\begingroup\$ Its readability is also a plus. \$\endgroup\$ – mbomb007 Jul 25 '16 at 15:45
  • \$\begingroup\$ but I have yet to get that supreme glory :s \$\endgroup\$ – dwana Jul 26 '16 at 9:41
  • 1
    \$\begingroup\$ +1 for my favourite quote :D \$\endgroup\$ – Beta Decay Aug 8 '16 at 14:39
  • 4
    \$\begingroup\$ I was going to post "#Java, on second thought, nevermind." But this seems more mature. Good on you for taking the high road. \$\endgroup\$ – Magic Octopus Urn Nov 23 '16 at 15:18
  • \$\begingroup\$ @carusocomputing :) \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Nov 23 '16 at 15:34
27
\$\begingroup\$

Retina

Before we start: if you hate regex with a passion, you can stop reading here. You're not getting around using regex when coding in Retina. That said, you don't need to be a regex expert either. A willingness to learn more about them should suffice. ;)

Retina is different

This language doesn't really follow the same patterns as any mainstream language. The closest thing is probably the Unix shell utility sed. There are no variables, assignments or function calls. Your program is just a sequence of commands (called stages) which receive a string as input and produce a string as output. The first stage's input is simply STDIN and the last stage's output is STDOUT. And every single stage processes the input by applying a regex. This results in a fairly unique mix of the imperative and declarative programming paradigms.

My point here is, solving problems in Retina often requires very different approaches than in other languages, and that makes you think outside of the box. Even though all you can do in the language is string processing, Retina is perfectly capable of solving arithmetic problems (and often in very concise ways), but chances are you'll have to think about alternative number representations. Coding (and specifically golfing) in Retina can be an interesting puzzle but at the same time it's not impossible to come up with a first attempt to solve a given problem.

Also, while this is true of many languages, golfing in Retina is interesting because There's More Than One Way To Do It™. For many problems, there's a trade-off between using a single elaborate regex, or processing the input via a series of simpler steps, and Retina's growing arsenal of stage types allows a variety of approaches to most problems.

Retina is competitive

Of course, Retina isn't quite the powerful general-purpose golfing language like Jelly or 05AB1E, and doesn't regularly win the competition, but for certain kinds of challenges it's often within reach of the top answers, and it has won several challenges in the past. Its syntax was largely designed with golfing in mind, and for certain string-based problems, there's no shorter way to express a solution than with a regex or two.

Retina is useful

I find that having a good grasp on regex is a huge productivity boost, even if you don't use regular expressions in your day-to-day coding activities. One often has to restructure larger pieces of code or other strings in a systematic way, and being able to do so with regex can be very convenient (at least for those who aren't fluent in vim or emacs).

Retina has become sufficiently expressive that I regularly use it at work to write throw-away scripts for larger string transformations. Thanks to its online interpreter (courtesy of Dennis), I can just quickly open a tab with it whenever I need it and type out a quick script to do what I need.

Retina is under active development

I guess this is both a disadvantage and an advantage. Of course it means that the language occasionally changes (potentially breaking previous features), so you might have to readjust a bit occasionally. However, it also means there are still exciting features to be added in the future, further broadening Retina's possibilities (you can think of it like free DLC :P), and it also means you can help shape the language by letting me know what sorts of features you'd find useful or which ones you think I messed up. I'm very happy about any kind of feedback on the language!

Hooked?

If any of that has sparked your interest...

  • There's a Retina chatroom where you'll usually find me or a couple of other regular Retina users who will be happy to answer your questions (and if no one's around, just ping me and I'll get back to you). I also announce new releases in this chatroom and occasionally discuss new feature ideas.
  • There's the official language documentation which I'm keeping up to date with every release. If anything is unclear, please let me know, so that I can improve it. :)
  • And there's the online interpreter on Try It Online where you can jump right in.

With the language still subject to change, there isn't a proper tutorial yet, but I'm hoping that those three links will get you started in the meantime. :)

\$\endgroup\$
  • 6
    \$\begingroup\$ I like it. Retina is quite a unique language. It always puts a smile on my face to see a retina solution as its unique, and almost always involves some wizardry hackery. \$\endgroup\$ – Rohan Jhunjhunwala Jul 20 '16 at 22:12
26
\$\begingroup\$

Brachylog

A declarative logic language

The vast majority of golfing languages on this site are stack based. Some are also imperative or APL-like. Very few are declarative (Brachylog is probably the only logic language regularly used on PPCG nowadays).

This means that your mindset when writing Brachylog answers is often completely different than the mindset you have with other languages, and thus the things you can exploit to shorten your code are also completely different (e.g. backtracking, pattern matching).

High level built-ins and meta-predicates

Partly because it is a declarative language, and partly because it is unfinished, Brachylog's built-in predicates are mostly high level relations.

A big part of writing Brachylog code is using meta-predicates that apply on other predicates. For example, there is no built-in to transform a string into a list of characters, but one can get the same relation by applying f - Find all to e - Enumerate: Enumerate unifies its output with one character of the input string, therefore applying Find all will yield all characters of the input string through backtracking.

Another interesting feature of Brachylog, which also exists in Prolog, is the fact that most predicates can be "called in all directions". For example, @n splits its input string into a list of strings on line breaks. But this can also be called with the input as a variable and the output grounded, thus concatenating a list of strings into a single string with line breaks between each element. The code that does those operations is exactly the same for both.

Because of this lack of very specific built-ins and the declarative nature of the language, Brachylog answers are almost always longer than other golfing languages.

Constraints programming

Brachylog is the only declarative language, as far as I know, where all of integer arithmetic is based on constraints programming (here, using the CLP(FD) library, which actually makes a mention of Brachylog).

This makes operations on integers very declarative instead of the usual imperative paradigm. For instance, If you want to find all couples [I,J] of integers which sum to 42, then you simply use the + predicate as you would when summing a list of numbers with grounded values:

[I:J]              Input (a variable which will be returned) is the list [I,J]
     :#$a          Apply #$ (is an integer) to all elements of Input
         +42       The sum of I and J results in 42
            ,      (At this point, I and J have no values but are constrained 
                   such that their sum is 42)
             ?=    Assign a value to I and J

When running this in the interpreter, we can ask for as many answers as we want (pressing ;) and see that this predicate "returns" as many correct answers as we want:

?- run_from_atom('[I:J]:#$a+42,?=',Z).
Z = [0, 42] ;
Z = [1, 41] ;
Z = [-1, 43] ;
Z = [2, 40] ;
Z = [-2, 44] ;
...

Learn more about Prolog

Brachylog is based on Prolog, the transpiler transforms your Brachylog code into Prolog code, and the transpiler itself (and all built-ins) are written in Prolog. Needless to say, I learnt a lot about Prolog by creating and using this language.

While Prolog is definitely not the most used language in the world, it's still a nice paradigm to taste that will change the way you look at programming problems.

\$\endgroup\$
  • \$\begingroup\$ Great explanation! I don't understand the Enumerate/Find all example -- what does Enumerate do, and how does backtracking feature in Find all? \$\endgroup\$ – xnor Jul 20 '16 at 10:10
  • \$\begingroup\$ I'd argue Retina is very declarative \$\endgroup\$ – Ven Jul 20 '16 at 11:44
  • \$\begingroup\$ @xnor Enumerate with a string as input is true iff the output of enumerate is one character of that string. The first output it will give is the first char, if we backtrack (i.e. give me another valid answer), it will give the second char, etc. Using findall means it will explore all choice points and thus all chars of the string. Hope that's clearer \$\endgroup\$ – Fatalize Jul 20 '16 at 11:54
  • 1
    \$\begingroup\$ @ven true, though Retina is more of a pattern matching language than a logic language. \$\endgroup\$ – Fatalize Jul 20 '16 at 11:55
  • \$\begingroup\$ @Fatalize true :) \$\endgroup\$ – Ven Jul 20 '16 at 12:01
  • 2
    \$\begingroup\$ Honestly, Retina itself is pretty imperative, but of course it makes extensive use of regular expressions which are themselves declarative. That definitely makes for a weird mixed-paradigm language though. \$\endgroup\$ – Martin Ender Jul 20 '16 at 14:39
  • \$\begingroup\$ @Fatalize That makes perfect sense, thanks! \$\endgroup\$ – xnor Jul 20 '16 at 22:51
18
\$\begingroup\$

J

J is different

Syntax, datatypes, built-in functions: J differs from most mainstream languages in all of these aspects. J is the successor of APL (that language with all the weird Unicode symbols), and conforms to the array programming paradigm. This means that J effectively forces you to think of most golfing problems as transformations of multidimensional arrays, which are the most important datatype in the language. It also provides a large collection of seemingly weird but very powerful built-in functions for that purpose; soon you will wish other languages had them too. For example, instead of loops, you have functions that automatically distribute over arrays.

J is also largely functional, which means that a J program is really one big function constructed from smaller functions using different modifiers and combinators.1 For example, computing the number of 2s in a numeric array can be done with the function +/@:=&2. Broken into parts, it reads as follows:

/   Reduce by
+   addition
@:  (function composition)
=   the equality bit-array
&   (argument binding)
2   with the number 2.

The syntax of J is built around this way of structuring programs, and it often results in very short code performing complex tasks.

J programs are like puzzles

Because of J's syntax rules and the array paradigm, golfing in it will usually proceed in stages. First, you must re-think the problem at hand in terms of array manipulation. Once you are somewhat familiar with J's standard library, this will start to come naturally. Want to find the index of the third occurrence of every character in a string? Just iterate over the prefixes, count the number of occurrences of their last characters, and mark those for which the count equals 3.

The next stage is to write your array manipulation algorithm in J. The unique syntax rules of J make this phase seem like a strange jigsaw puzzle: you start with small pieces of code that perform parts of what you want, and then try to combine them into a coherent whole, using forks, conjunctions and other syntactic features. When you finally golf your program, you will slide the interlocking pieces into new positions, losing some of them or switching into shorter alternatives, until there is nothing left to take away. I personally find this process very creative and rewarding.

J is terse, but not a golfing language

J, and other languages in the APL family, have a unique place in the golfing community. On the one hand, they are actually used by professionals in various fields, and thus have mature libraries and small but faithful user bases. They have many features that distinguish them from pure golfing languages, like the two-character function names of J and their lack of built-in string manipulation functions. On the other hand, J was specifically designed to be a terse language, which makes it very rewarding to golf in. I believe this gives you the best of both worlds.

Resources

1 J also supports variables and imperative constructs like while loops, but they are rarely useful in golfing.

\$\endgroup\$
  • 2
    \$\begingroup\$ Great summary. I'd like to add that J offers a variety of mathematical functions (as well as supporting the inverse of most of them) that may offer alternative solutions which could possibly be shorter. Also, another helpful link is the NuVoc. \$\endgroup\$ – miles Jul 31 '16 at 23:43
  • \$\begingroup\$ How about J vs. Jelly? \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Dec 31 '16 at 23:57
  • 1
    \$\begingroup\$ @noɥʇʎԀʎzɐɹƆ I'm not familiar enough with Jelly to make a fair comparison. The last paragraph obviously doesn't apply. My impression is that Jelly's syntax is closer to J than any other language, so the second paragraph probably applies, but you have a lot more puzzle pieces to choose from. I'm not sure how strongly Jelly adheres to the array paradigm (I believe Jelly uses Python-style ragged arrays, while J has rectangular arrays and keeps track of zero dimensions: a 0x1 array, a 1x0 array and a 1D array of length 0 are all different). \$\endgroup\$ – Zgarb Jan 1 '17 at 8:17
15
\$\begingroup\$

Haskell

Haskell is the functional language

Want to dive into the deep end of functional programming? In Haskell, lambdas are cheap, higher order functions are powerful, and all operations short-circuit by default. Golfed Haskell code is often mind-bending, not because of magic variables with arbitrary rules, but because it can manipulate infinite lists and function-transforming functions like other languages manipulate numbers and strings. On the other hand, Haskell has a slightly cumbersome I/O model, you cannot reassign or mutate variables, and the powerful type system sometimes gets in the way of golfing. I don't view these as shortcomings of the language, but as interesting challenges that force me to golf in novel ways.

Pattern matching

Haskell has really economical pattern matching syntax, and while not as flexible as Mathematica's, it beats most other languages in this respect. It is especially convenient in case of lists. Let's define a function f that splits a list at the second occurrence of the first element, e.g. [0,2,2,3,0,1,0,1] -> ([0,2,2,3],[0,1,0,1]):

f(x:y)|(a,b)<-span(/=x)y=(x:a,b)

Here, f takes a list with head x and tail y. We use the "pattern guard" syntax | to bind the result of span(/=x)y (split y into the longest prefix where all elements z satisfy z/=x, and the rest) to the pattern (a,b). The function span returns a pair, and instead of giving it a name, we name its two components. On the right of = is the result of f, where x has been tacked back to the first part of y. Simple, right?

Lazyness

Haskell is lazy by default: computations are not performed until you request their result. This is a generalization of the short-circuiting behavior of Boolean operations that many languages have. For golfing, the most important application are infinite lists, which are a bit like iterators/generators in more "normal" languages. In fact, the function f we defined above readily works for them! We can try it on the infinite cyclic list [0,1,2,3,0,1,2,3,...], and extract only the left part of the result:

> let (a,b) = f(cycle[0,1,2,3]) in a
[0,1,2,3]

We bound the result to the pair (a,b) and extracted a; since the infinite tail b wasn't needed, Haskell didn't bother computing it. For a more involved example, see this answer where I define an infinite list in terms of itself and take the first n elements of it.

Higher-order functions

The Haskell standard library has a large collection of useful higher-order functions (functions that take other functions as arguments), and you can get access to many more by imports. We have the usual suspects: . for function composition, map for applying a function to every value in a list, and foldr for reducing a list by a binary function. The more exotic functions include iterate, which gives the infinite list of repeated applications of a function, and =<<, whose behavior depends on the types of its arguments; on lists it's "map, then concatenate", and on functions it's "compose with extra argument".

The span function we used earlier is also a higher-order function, since its argument (/=x) is a function. Haskell's syntax makes it really easy to create auxiliary functions: you can partially apply operators as above, create an anonymous function with \x->x+2, and every function with missing arguments is automatically curried. For example, span(/=2) is a function that splits a list on the first occurrence of 2.

Resources

\$\endgroup\$
  • \$\begingroup\$ I don't see how this assists in golfing... \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Nov 23 '16 at 15:34
  • 6
    \$\begingroup\$ @CrazyPython It doesn't. I wrote it more as a pitch for why Haskell is an interesting language to golf on. \$\endgroup\$ – Zgarb Nov 23 '16 at 15:42
  • 1
    \$\begingroup\$ Wonderfully written! I was going to post for Haskell eventually, but you say everything better. \$\endgroup\$ – xnor Nov 23 '16 at 18:29
  • \$\begingroup\$ Do you know any golfing language based on Haskell? \$\endgroup\$ – Fatalize Nov 25 '16 at 10:33
  • \$\begingroup\$ @Fatalize I'm not aware of one. I've been toying with the idea of creating a Haskell-based golflang, but I'm lazy and there's an abundance of golfing languages already. \$\endgroup\$ – Zgarb Nov 25 '16 at 10:37
  • 2
    \$\begingroup\$ @Zgarb There certainly is not an abundance of functional golfing languages :) \$\endgroup\$ – Fatalize Nov 25 '16 at 10:38
14
\$\begingroup\$

C

C's been around for a while, which means it's full of weird legacy stuff useful syntax. Golfing in the language turns out to be a great way to discover its strange history and non-standard extensions.

It's not exactly competitive against other languages (except Java of course), but it can be fun to compete against other C answers. This is mainly because while there are usually a couple of drastically different ways to solve the same problem, it's still possible to be inspired from parts of other answers.

The design of the language means obscure pointer arithmetic and crazy bitwise operations are to be expected when golfing, so if you want to brush-up on those skills, it's ideal. Also the built-in function names are long (but not C#-long), so you'll need to work to minimise your use of them, which itself drives a different mindset.

Finally, because C was never designed with golfing in mind, there's quite a lot of satisfaction to be found when you discover a neat way to abuse operator precedence, standard library functions, pointer arithmetic / unsafe casting, implicit declaration of functions, printf syntax, short-circuit evaluation, recursion, etc. etc.

\$\endgroup\$
  • 4
    \$\begingroup\$ I think golfing in C is actually really fun. It's a lot more competitive than you might think. I think it's better than python (sometimes), and there since there are so many different compilers and weird behaviors, you get some fun hacks. \$\endgroup\$ – DJMcMayhem Jul 28 '16 at 4:30
13
\$\begingroup\$

Perl

Perl is a terse, multi-purpose, well-documented scripting language that is quite well-suited to many golfing tasks. It's by no means the best, but can often be in the top 3 languages of solutions.

Availability

Perl is available on all platforms for free, and is pre-installed on many systems by default (a lot of Linux distros and OS X) providing one less barrier to getting started. Whilst its syntax can look quite intimidating, it's usually just a combination of the various built-in command-line switches, special variables and regular expressions.

Regular Expressions

Perl's flavour of regex is ported to a lot of other languages for its versatility and can be (ab)used for great entertainment. Where it's built in to the language at the core, its syntax can provide you with a short, easy way to extract data from strings:

$_="This is a test";
@l=/\w+/g; # @l is now a list: ("This","is","a","test")

$_="38.8977,77.0365";
/,/; # $` is now set to "38.8977" and $' is "77.0365"

Whilst you don't have to know regular expressions to use Perl, you'll quickly find that a lot of the benefits of the language come from this aspect, and the associated magic variables.

Magic Variables

Ok, not really "magic", but there are a lot of predefined variables that can be used to shorten output, perform some functions (automatically round, automatically match against, pre-initialised to "\n" or " ", any many more. Whilst using these might be confusing at first, all these variables are well-documented.

Well-documented

Since Perl has been around for quite a while, there is an abundance of documentation, tutorials and guides on how to use the language. Also, since it has been used for golfing for probably almost as long as it's been around, there are a lot of resources that can help you get started or test your newly found skill-set.

A General-purpose Tool

If you spend any amount of time on a remote server extracting information from files, you can easily use Perl's short syntax combined with its flags to manipulate files easily and extract what you need. Since it's available on almost every server I've been given access to, you'll never wonder how to extract the passwords from all 40 configuration files ever again!

Summary

Perl isn't always competitive, but it has some pretty fun tricks to outperform some languages. I've been using code golf as a way to improve my understanding of the language and get better and more confident using it in my day-to-day work. Whilst I might not use the syntax I'd use in code golf, I certainly use my greater understanding!

\$\endgroup\$
12
\$\begingroup\$

V

You should golf in V because it's different, competitive, and powerful. V is a very interesting language, that functions very differently than any other language I have ever used. Most of the quirks of V make it somewhat hard to learn, but also offer a lot of potential for golfing.

V is different

Most golfing languages have tons of math-based operations. V does not even have numbers. Everything happens in a gigantic 2D array of characters. Now, that's not to say you can't do mathy operations on these strings, but this is still just simulating math through the manipulation of the characters in the buffer.

Another quirk that makes V more fun to play with is the cursor. The program keeps track of a "cursor" which is just the location of where all the string base commands will actually do their operations on the buffer. Here's an example.

The 'x' command deletes the character under the cursor. (demo) The 'w' motion moves forward one word, so if the program was wx, this would delete the first character of the next word. (demo) There are many other motions such as

e     "End of this word
E     "End of this WORD
b     "Previous word
B     "Previous WORD
<n>|  "The first (default) or N'th column
$     "Last column
G     "Last line
<n>gg "The first (default) or N'th line
f<n>  "To the first occurrence of 'n'

Also, fun fact about V: Even though it is an entirely string-based language, it doesn't even have string literals!

V is modal

In most golfing languages, a command is a command. In V, there are 4 different modes, where each character does drastically different things. For example, <C-a>, e.g. 0x01 can mean either "increment the next number" or "Re-insert the previous text". <C-r> can mean "Redo the last change", or "Insert the contents of a certain register".

Since V will eventually use a 255-character code-page, this means there are way more builtins possible.

V is composable

Here's where we get to talk about the fun part of V! Every command is either an operator, or a motion. Each of these do next to nothing by themselves, however V chains commands together in a very fun way!

Here's an example. The motion 'w' moves the cursor to the beginning of the next word. '$' moves to the end of the current line, and '|' moves to the beginning of the current line. These are all "motions", or as I like to think of them "nouns". They all take "counts" e.g. '2w' moves two words forward, or "5tt" will move until the fifth occurence of the letter 't'.

'd' is an operator, or as I prefer to think of it "verb", and it's mnemonic is (d)elete. So what exactly does it delete? Whatever you want it to! Want to delete a word? Then "dw" will (d)elete a (w)ord. Want to delete until the end of this line? "d$"! Or you can (d)elete until you (f)ind the next letter (i) with "dfi", or you can delete until the last line with "dG", or you can delete a straight line until the last line with "dê"!

This does not even begin to scratch the surface of all the various fine-grained movements you can pass as an argument to the "delete" operator.

You could even construct a crazy command like:

ç/regex/"Ay3ff

Which is

ç               "On every line:
 /regex/        "Where "regex" matches
          y     "yank
        "A      "Into register 'a'
           3ff  "Until the third occurence of the letter 'f'

However, here is where V get's really cool. Every single argument that can be passed to 'd'? You can pass those motions (or nouns) as arguments to every single operator. (c)hange, (y)ank, ä, or duplicate, (v)isually select, etc. That's what being composable really means.

V has history

V was heavily inspired by vim. In fact, it actually is vim under the hood. Vim is a very successfull text editor that has been in active development since 1991. Vim was heavily inspired by Stevie (1987) which was heavily inspired by Bill Joy's vi (1976). There's a reason this editor has been around for 40 years. Sure, it might not be awesome at playing with numbers, but it knows it's purpose (transmogrifying text), and it does it well.

V is competitive

I have seen V go toe-to-toe with languages such as Osabie, Retina, Jolf, Jelly and Pyth. It hasn't won every single time, but I have seen it beat each of these languages. (Granted, on a small subset of problems) Using it's "compressed regex" system, it's unique way of taking inputs and outputs and it's verb+noun system I think V is a very competitive language, that will only become shorter as I work on it more.

V is in active development

This could be seen as a good thing or a bad thing. On the downside, the documentation isn't awesome, and some features might not always work. On the upside, you can be a part of helping shape it and turn it into an even more competitive language.

\$\endgroup\$
11
\$\begingroup\$

JavaScript ES6

Hearing "JavaScript" you may think:

Uck that language with the weird type system?

and that's one of the reasons it's so enjoyable and great to golf in!

Why ES6? Well the days of function(){return arguments} are over. ES6 is the latest version of JavaScript looking to give the language a make-over to better suit the growing demands of web development. This brings to the wide assortment of features in JavaScript to make it enjoyable to golf in!

Type Casting

This is both a beautiful and horrible thing JavaScript does but when you're code-golfing it's the best. In most language's to add two strings you'd do something along the lines of:

(Number::a)+(Number::b)

but in JavaScript you can just abuse the type casting!

a- -b

what? Well if we used + it would think we're joining the strings so in JavaScript when we use -, it essentially "forces" it into using a and b are numbers.

Arrow functions

Again, these are a feature that make ES6 much more competitive in golfing. Compare the two:

function(a,b){return a+b}
a=>b=>a+b

The latter is a ES6 arrow function. Which support all sorts of abuse:

(a,b=a/2|0)=>(a+b)/b

You can use the weak typing of JavaScript to your advantage, use default function parameters to shorten variable declarations.

Destructuring

Lemme give you one of my favorite answers as an example, it's very well golfed thanks to destructuring:

(a,z,d,f=([a,g,k,p])=>g*k*(a[6]?p/-~!a[8]:3.14*g))=>Math.ceil(f(a)/f(z))*d

To avoid constantly referencing an array using [n] which would result in a large use of bytes. You can use array destructuring in argument params to extract the the first n items of an array to variables

JavaScript is golfed

I'd say they are more avid JavaScript golfers than any other non-esolang (I'm not talking about just PPCG) as JavaScript is one of the few languages commonly golfed for production. They are so many resources on golfing in JavaScript, our tips post has pages detailing how to abuse its typing system. All this makes it an easy language to start golfing in

No need for imports

In many language you probably see import <whatever> a lot, but due to JS's lack of a module system everything is already there! This includes the Math namespace and the build-in compression (it's not a compression function, it's just base64 but we abuse it for compression) function. While you may not use, for example, the image built-ins all too much, you don't have wasted bytes on imports

Spread operator

This is up with the top 5 most useful ES5 features. It'll take a bit to explain so I'll give examples:

(...args) => args.map(arg => arg + 1)
// f(1,2,3) -> [2,3,4]

[..."🐐🐐🐐"] -> ["🐐", "🐐", "🐐"]

You can abuse this for range creation: [...Array(n)] and all sorts of things. It can be used for hacky string reversing:

s => [s,...s].reverse().join``
// f("hi") -> ihhi

What's going on here? Well this uses the spread operator to "split" the string. It does the same as:

s+s.split("").reverse().join("")

Template strings

These are too cool for words:

`first
second line
${1+1+1}rd line`

These allow inline newlines and formatting. The coolest part? You can omit parenthesis when using them (sort of) e.g.:

[1,2,3].join`a` -> "1a2a3a"

Eval

Eval abuse is best shown, not tell (and because I'm getting tired of writing):

(n,m)=>eval("for(o='',q=(b,s)=>' #'[z<b|0].repeat(b)+(z?'   ':s),z=i=Math.hypot(n,m);z--;)o+=q(n,' + ')+q(m,' = ')+q(i,'')+`\n`")

eval is like running a code in the REPL. it'll implicitly return the last result. You can write a multi-line function but that requires a return which is a large use of bytes. By using eval you can use fors but still avoid having to use { ... } and return

\$\endgroup\$
  • \$\begingroup\$ "This is up with the top 5 most useful ES5 features.", I think you mean ES6... f=s=>[s,...s].join``;f("hi") -> ihhi is how I'm interpreting that block, which means either it's wrong or misleading. That expression yields "hihi", not "ihhi". Lastly, I wouldn't expect anyone to realistically follow that last example. If it's a REPL, it doesn't make much since because when I executed it (I'm not sure what n and m are supposed to be) it crashed my browser. \$\endgroup\$ – Patrick Roberts Jul 22 '16 at 13:35
  • 9
    \$\begingroup\$ "You should be downvoting if you think JS is a bad language to golf in" is complete and utter rubbish. Votes on answers to this question should be based on whether the answers are good, not the languages they advocate. \$\endgroup\$ – Peter Taylor Jul 22 '16 at 19:11
  • \$\begingroup\$ @PeterTaylor well yes, if my answer is bad then you wouldn't think JS is a good language to golf in (at least that's what I'm assuming). \$\endgroup\$ – Downgoat Jul 22 '16 at 19:13
11
\$\begingroup\$

Machine code (specifically, x86)

Many arguments apply to all machine code languages, but I'll advocate x86 here because it's what I know best, and because it's more fun than some other ones (see below).

Unusual

The first reaction to seeing code golf in machine language is "WTF". It's not even clear at first whether this is a programming language at all, though undoubtedly it is.

Widely supported

Many computers use the x86 instruction set natively, and those that don't (e.g. x86-64 computers cannot run the very old 16-bit variant) have emulators.

There are many tools that help you write and debug code. Any assembler will let you write in human-readable assembly language, and output machine code. And any good general-purpose debugger will debug machine code (converting it to assembly language).

Also, documentation is pretty extensive. Searching the Internet will always provide rich information. This is unlike some esoteric languages, which often have poor documentation on a single site.

The Real Thing

Because machine code is used all the time, golf skills also help in real life. For example, trying to debug a crashing C/C++ program (yes, some people are still doing this in 2016) will require some thinking in terms of machine code and assembly language.

Fun

Density (number of bytes per unit of logical complexity) of machine code is an important factor in its design. So machine code is good for code golf. Especially the x86 variant, which was designed in 1978, when code density was very important.

For example, adding 1 to a register is encoded with 1 byte. For best code density, you have to use this in places where it was not intended, e.g. to generate the number 1: generate the number 0 first, and then increase by 1.

The basic x86 instruction set has dozens of instructions (the more recent 32-bit and 64-bit variants have many more) that sometimes work in surprising ways, and all this can be exploited for making short code.

Competitive

Machine code's competitive performance is between golfing languages (like Pyth) and normal ones (like C).

In some case, the debuggability of machine code is a great help in making it competitive - some challenges might be too tricky for implementing in golfing languages, but doable machine code.

\$\endgroup\$
9
\$\begingroup\$

Python

Python is one of my favorite languages to use on this site. There are a few reasons for this:

1. Easy to learn

  • Python is verbose enough that you can often tell what a program does at a glance.
  • Documentation is readily available.
  • It's a popular language (currently 4th on the TIOBE index), so there are many tutorials and tips available for new users. Since it's also useful in the real world, you may benefit from learning the language. List it on your resume!
  • There are many useful questions and answers for Python on StackOverflow, and you can always ask a new question if you can't find what you need.

2. Popular to golf in

  • It is a popular choice on this site, meaning that many users know it and will often give helpful suggestions to golf or otherwise improve your answer.
  • There is a tips page, and it is the highest rated of any tips page on the site.
  • There is more intra-language competition than average, driving users to constantly improve their Python-golfing skills.

3. Useful features

  • Multiple methods of taking input. You can answer with functions and taking input as a parameter. You can use input() in Python 2 to automatically eval input.
  • Variables are not type-restricted, and Python is not super strict about types. This means that you can use a variable as a string, then later convert it to a list and store it in the same variable.
  • Strings work a lot like lists. Both strings and lists can be sliced like object[start:end:step], so printing every 2nd character is as simple as s[::2], and reversing is s[::-1]. You can also multiply a string by an integer to repeat the string, so 3*"hi" == "hihihi".

4. Resources and interpreters

  • Python.org - Downloads, tutorials, documentation, updates, and jobs
  • Repl.it - REPL interpreter, anonymous program saving
  • Ideone - Online IDE, create an account to save
  • Pythex - Python regular expression editor
  • Learn Python - Free, interactive tutorial
\$\endgroup\$
6
\$\begingroup\$

Perl 6

While often not seen as golfy as Perl 5 (less magic going on everywhere), this language has many constructs and included batteries that are useful for golfing.

But this language has a looooot of very useful syntactic sugar. Without going too deep into "tips for golfing", just a few...

The whatever star

Make a function out of pretty much any expression.

*+*
*.foo.bar
-*.call

# equivalent to (those are lambdas, Ruby-style)
-> $a, $b { $a + $b }
-> $a { $a.foo.bar }
-> $a { -$a.call }

Bags

A bag is a set that kept the number of occurences. It's very useful for counting number of matches when doing matching/parsing. (e.g. here).

Dot-calls

If you know Perl 5, you know about the topic variable, $_, that many constructs (for, with, given, ...) set for you.

In Perl 6, any bare dot in term position (e.g. not a function call) is interpreted as acting on $_.

.say for @array;
# same as
$_.say for @array;
# same as
for @array { $_.say } # the semicolon is optional at the end of a block
# same as
for @array -> $str { $str.say }
# which happens to exist as a function as well
for @array -> $str { say $str }

Lazy / infinite arrays

1..Inf # an array from one to infinite.

Useful when you don't know beforehand when you're gonna stop.

Unnamed variables

And last but not least... Variables can not have a name. They're interpreted as state variables. Works for all sigils ($@%).

say $_ x ++%{$_} for 'abc def ghi abc'.words) # each will be repeated the number of times it's been seen.

All those can make for some very cute, err, unreadable code! (thus properly golfed :P)

{$_>1&&.[0].value==.[1].value??""!!.[0].key given .lc.words.Bag.sort:{-.value}}
{.comb(/<-[_\W]>+/).Bag.sort:{-.value}}
{.split('').map({$_ x++%.{$_}}).join}
\$\endgroup\$
  • 1
    \$\begingroup\$ Wow, whatever star seems like super cool feature \$\endgroup\$ – Downgoat Nov 23 '16 at 0:03
6
\$\begingroup\$

Pyke

Pyke like most first golfing languages is stack based. It uses a multi-type system combined with attributes of the stack to decide which functions to call and what the output should be like. Pyke has lots of features to help with . It's tree-like structure makes Pyke to be among the easier to read golfing languages.

Implicit input

The order of inputs is crucial as to how the program will behave. If the input stack is empty when input is required, it pulls it from the Q variable which initially stores the first input given. If the Q node is used, the first item on the input stack isn't used implicitly. Instead it goes through the other inputs before going back to Q when all are exhausted.

Implicit variables

The i variable is magical - in any repeating loop, the first item on the stack is automatically copied to the i variable (but only if i is actually used). This allows for more advanced input comparisons. At the end of a loop, if the i variable was set before the loop began, it goes back to what it was. This allows for nested looping with the i variable.

The j and i variables are unset at the beginning of the program and when first used automatically store the first item on the stack inside of them without popping it. When used after a variable has been stored in them, they add that variable to the stack.

Predefined variables

Every node in the Pyke language can store a variable which can be retrieved with ~<node>. Among these constants include multiple permutations of the upper and lower case alphabet combined with numbers and/or with punctuation.

Pyke also comes with other useful constants such as e and pi but also comes with various time related constants such as "seconds", "minutes" and "hours" for those annoying date challenges that require them specifically. Pyke has those constants in plural and singular form.

Predefined English dictionary

Pyke comes with a simple dictionary compressor which converts words to unicode form. A translator to this form can be found here. It only works with words in it's dictionary and is lower case only without punctuation so it is rather limited in that way.

Easily testable

Pyke has a dedicated server hosting a testing website which can be found here and comes with documentation for every function callable. This documentation can be found in pure html form here. By default, any warnings and errors are shown to the user which can help creation of code. The website also comes with an auto-answer function which copies a pre-built header with character count and code as well as a Try it here! link.

Pyke is a fun language, just like it's parent, Python. Unfortunately, Pyke doesn't have a yet :(

Pyke is available on github under The MIT License (MIT).

\$\endgroup\$
6
\$\begingroup\$

Verilog (pending community approval).

Yes, this is an HDL, used for FPGAs, FPGA simulation, and hardware design. There are some (many?) tasks that it cannot handle efficiently--it does not offer some data structures such as maps (except with integer keys using large indexed arrays) but when bit-twiddling, logic, or the like are involved, it can be extremely powerful.

When written in the correct manner and given sufficient leeway in the challenge problem to allow an FPGA to be used instead of a computer (with input either preset in the bitstream or through pins) one can reach throughputs of around a hundred million loop iterations per second (assuming 100MHz clock and either single stage or full pipelined), in cases where the result must be provided within a reasonable time. Even FFTs can be done in short amounts of time, as low as a few clock cycles (at the expense of code length).

Supports arbitrary-width integers out of the box (no Java-like verbose method calls, just declare integers in a format such as reg[4095:0] (4096 bits in this case) and use normal operators. Fixed-point non-integer values are also possible. Other fancy tricks include reduction operators such as and/or/xor over all bits using a single unary operator.

In many cases, its weird dataflow can be extremely useful. Not many languages let you quickly and easily trigger on the rising/falling edge of a variable without massive amounts of boilerplate. Use this to trigger code quickly and easily, even implicitly (since most compliant implementations should even let you trigger on an edge of a single bit of an integer, thus letting you catch overflow and other arithmetic "events").

Non-blocking assignments allow you to delay the actual assignment until the end of a block and continue using the old value, while blocking assignments behave like in standard languages.

Modules can be defined and repeatedly instantiated (even recursively), with generate loops allowing you to slice input across multiple modules, and the like. You can define a module that acts on a single bit/byte/whatever of a long input, and instantiate that module in a loop with a different bit/byte/subset of the input connected to the input port of that module.

A preprocessor lets you use macros, with parameters, to reduce code duplication.

Assign statements allow you to assign a wire-type variable to some rvalue, and when the inputs change the variable automatically changes as well. Consider assigning wire a as wire a = b|~c. Now, a will always be equal to b|~c, even after b or c change. With additional code you can even use case (switch) statements, if/then, and the like to auto-update a variable based on inputs, or even add latching behavior (value only updates under certain conditions).

Like many submissions here, this language is hard. Partially due to its counter-intuitive behavior at times, partially due to its verbosity in some situations. However, in the situations where Verilog's features can be put to good use, they are quite rewarding.

Last but not least, very few languages offer debuggers that show waveforms and relative timing of variable assignments (although this requires additional characters to actually add visible delays for sequential programming, which can typically be removed for the final golfed version):

Simulator screenshot

\$\endgroup\$
  • \$\begingroup\$ Note that you can also use "simulation" mode or whatever it's called (it's been a while) to run the programs on a regular computer. This also has a bunch of side effects of allowing you to do things that are normally not possible on an FPGA. \$\endgroup\$ – FryAmTheEggman Jul 28 '16 at 17:48
  • \$\begingroup\$ @FryAmTheEggman I address that; see the bottom paragraph (which mentions an FPGA-related simulator such as ISim). IVerilog is also a useful alternative for those that don't want to install free (but closed-source and DRM'd) FPGA dev software. \$\endgroup\$ – Reinstate Monica - ζ-- Jul 28 '16 at 17:53
  • \$\begingroup\$ Sorry, what I meant to say is that you can do things like read/write to/from STDIN/STDOUT in the cases where stuff like that is more convenient than an FPGA's inputs/outputs. Although these simulations are not 100% accurate to what will work on a FPGA, it should make verifying them somewhat easier (particularly for people who have no idea how to read waveforms, etc). \$\endgroup\$ – FryAmTheEggman Jul 28 '16 at 17:59
  • \$\begingroup\$ @FryAmTheEggman Potentially; however, as I'm trying to sort out here there are other I/O methods that may be more useful such as pre-filling/saving to block RAMs, which are also within the realm of the simulator, but require either a GUI simulator or extra boilerplate code to load and display the block RAM contents at the start and end, respectively. \$\endgroup\$ – Reinstate Monica - ζ-- Jul 28 '16 at 18:03
5
\$\begingroup\$

PHP

PHP is a web development language (Think CSS and HTML) that can also be used as a regular programming language. As such, it fits rather strangely right in the middle of both. Coding in PHP can be done in many different ways, and one of the reasons it's fun to golf in, is that PHP is very lax about how it lets you do things.

Types

PHP has weak typing, so a variable when created can be assigned any value you please. As well, type-casting is automatic in most situations, so throwing a string where a number is expected often works. PHP hunts for the first number in the string to use ("123Hello" = 123), or treats it as a 0 if there's no number. And since PHP has a different operator for concatenation of strings, we don't have to worry about accidental typecasting when we don't want it.

"1" + "2" = 3
"1" . "2" = "12"

Numbers can also be used as strings in the same way!

1 . 2 = "12"

Variables

Wanna declare a variable? Do it whenever, wherever.

$string = 0;
$number = "2";

Wanna use a variable? Do it whenever, wherever.

// No variables initialized
$a = $n + $m; // Where the hell did these come from, then?

You see, PHP doesn't break if you try to use a variable without a value. It puts out a little warning, but otherwise runs perfectly fine! This allows for a lot of saved bytes thanks to not needing to declare variables before using them

$string = "";        // This first part is completely unnecessary!
$string .= "Hello "  // PHP just kinda assumes you're working with a blank string anyways if there's nothing there.
$string .= "world!"

$number++;           // No number, no problem! We'll just make that a 0 and then increment it...

Arrays

All arrays in PHP are associative arrays, similar to a Dictionary in C# or a Map in Java. Keys and values for arrays can be almost anything, and there's no set size for an array.

$array = []               // A blank array
$array = [1, "2", [3, 4]] // Some values to start
$array[1] = false         // Numeric keys are the default...
$array['fruit'] = "banana"// But string keys are fine too!

To add a value to an array, you simply set the position to whatever you want. No fuss about pre-initializing anything, the same as variables.

$array = []             // We start with a blank array...
$array[1] = 2           // And can start wherever we want.
$array['red'] = 'blue'  // Positions are created as needed.
$array[] = 'last'       // Not supplying a key automatically adds the given value to the end of the array

Oh, did I mention strings can be referenced like arrays?

$string = "Hello world!" // String[3] would give us "l"
$string[5] = ","         // Our string is now "Hello,world!"

PHP also comes with a whole bevy of built-in array functions, which can all be viewed here

Logic

PHP can compare any two values to evaluate a logical condition. You can see here what happens if you compare various types of values against each other.

Conveniently, PHP doesn't require you to explicitly do the evaluation! It's quite happy with truthy/falsy values, doing away with pesky things like $string != "" in favor of just $string.

Conditionals and Looping

PHP supports all the traditional constructs (if, for, while, switch) as well as a very convenient foreach syntax which allows you to keep track of keys and values as you go.

foreach ($array as $value)         // The simple syntax when you just want the values
foreach ($array as $key => $value) // But if you want the key, it's easy!

PHP also supports ternary operator (?:) as a shorthand for if/else syntax.

$a = $boolean ? $b : $c;                  // If our boolean is true, $b is assigned to $a, otherwise $c is.
$boolean ? something() : somethingElse(); // Doesn't have to be used solely in assignment, either.
$string = $me_if_not_false ?: $me_if_true // The shorthand version 'returns' the value used for logical evaluation if it's truthy.

Output

PHP, being a web-based language, makes it really easy to output to the screen.

echo $variable;          // Nice and simple.
echo $variable . "\n";   // With a newline.
echo $variable . "<br/>";// For you HTML nuts.

It's just that easy. (Warning, doesn't work with arrays, but check out implode!)

Sample program

From one of the challenges I posted in, Count without 3

for($i=$argv[1];!(++$i%3)|strpos(_.$i,'3'););echo$i;

for($i=$argv[1]                                     // We initialize $i because it's shorter ($argv[1] is the first argument passed from the command line)
               ;                                    // Our condition for ending the for loop starts here. 
                !(++$i%3)                           // Counting up from $i, we end the loop if it's not a multiple of 3 (if $i mod 3 equals 0).
                         |strpos(_.$i,'3');)        // Treating $i like a string, we also end the loop if we find '3' anywhere in it.
                                            ;       // This closes the for loop, as we don't need anything done during the loop that we're not already doing.
                                             echo$i;// After our loop ends, we output $i to the screen.

Conclusion

PHP is, in my opinion, a very fun language to golf in. Although it has some shortcomings compared to other languages (each variable is 2 bytes instead of 1, verbose built-in functions), it can be quite the brain twister to try and abuse all the cuttable corners it offers, and in the end can be quite competitive!

I hope you have fun golfing in PHP!

\$\endgroup\$
  • \$\begingroup\$ It is a crime in PHP to report an error or warning. And this is good? \$\endgroup\$ – programmer5000 Apr 12 '17 at 14:18
  • \$\begingroup\$ I've never seen anyone promote PHP. And you made it pretty well, it's one of my favorite languages and you made me like it even more :P \$\endgroup\$ – RedClover Mar 13 '18 at 15:01
4
\$\begingroup\$

C#

It's challenging

Similar to the Java answer golfing in a verbose language can be challenging and it is truly thrilling when you get an answer that isn't far off that of the dedicated golfing languages.

6.0 Syntactic Sugar

With version 6.0 C# has a lot more golfing potential with string interpolation, expression bodied members, and null conditionals.

Tooling

With Visual Studio 2015, C# can be written in a professional grade IDE at no cost with support for plugins.

Finally for me personally since I write C# in my day job it helps me test my knowledge of the quirks of the language and has helped me better understand parts of the language; a recent example of this is learning about Currying.

\$\endgroup\$
  • \$\begingroup\$ I really hate all the new C# 6 stuff... it really does make a big difference for golfing, but I am loathed to use all the short-hand syntax... Ruddy language designers focusing on code-golf and not readability... All that said, there is nothing better than beating Python at code-golf with a full C# program! \$\endgroup\$ – VisualMelon Jul 31 '16 at 12:44
4
\$\begingroup\$

Brainf*ck

You should golf in BF for the same reason you should golf in Java - it's probably not going to beat the golfing languages, but our community has decided time and time again that that doesn't matter to us. Writing short programs in BF is a challenge, but, unlike Java, it's not because you're bogged down by verbosity. Golfing in Java can feel frustrating because you always have to write all this boilerplate. In BF, on the other hand, there is none of that. Anything you'd want to do is one byte.

Another thing I like about BF is that it has a very low barrier to entry. It only has 8 commands, so it's quite easy to learn. You don't have to memorize all the builtins to compete. When golfing in CJam, Mathematica, or Jelly, for example, your submission could be crippled if you didn't know about one key builtin that solves a huge part of the problem. In BF, everything is done from scratch, which means nothing is trivial. Even the golfed Hello World program is 72 bytes, with multiple potential bounties awaiting anyone who can improve it. BF is a language that is challenging to golf in, but that means the solution is almost never trivial, and there's always room for improvement.

Besides, BF can sometimes offer clever solutions. It's easy to manipulate character byte values as numbers. And, of course, it's really, really good at while loops.

\$\endgroup\$
  • \$\begingroup\$ The second paragraph could be updated as it does not reflect the current best byte count. \$\endgroup\$ – Jonathan Frech Aug 18 at 4:58
3
\$\begingroup\$

Convex

Convex is, like many other golfing languages, stack-based. In my personal experience, stack-based languages are much easier to learn and easier to understand than others too. Convex is heavily inspired by languages like Jelly and 05AB1E, and built on top of the CJam platform. In fact, 99% of CJam programs are also valid Convex programs. However, here are the main things that make Convex stick out from the rest:

Convex is competitive

Currenty, all common operators are only one byte, and I am currenty in the process of making all operators are one byte. In addition, it has many operators that can prove to be very useful in golfing challenges. Most of the operators are overloaded as well, which allows me to add many more than just 255 operators.

Convex has neat features

Convex has many features that most other languages don't, such as...

  1. Full Regex Support: All of the more common regex operators are avaliable, as well as some uncommon ones. Convex also has some neat features for building regexes, including turning all strings in a list into a a|b|c|d regex and more.
  2. Complex Number and Quaternion Support: Convex has a built in Quaternion type, which allows both complex numbers and quaternions to be represented easily and flawlessly.
  3. Implicit input: Any input passes to the command-line arguments while running a convex program is automatically put on the stack for you. In addition, when an operator tries to pop from an empty stack it will simply read a line of input from STDIN. In both cases, the input is evaluated if possible so you don't need to convert from strings to ints in the program.

Convex is Still Being Developed

I work on Convex everyday and always have the latest version avaliable on Github. Additionally, I am currenty porting Convex to Python (whereas it is now written in Java) which allows me to more easily add operators and allows others to easily contribute as well. Here are some features to look forward to:

  1. Infinite precision maths.
  2. File IO, HTTP requests, and a Python eval operator. Note that there is also a safe mode that disables these operators.
  3. No two-char operators.

Want to Get Started?

Here are some useful links:

\$\endgroup\$
  • 1
    \$\begingroup\$ Convex chat room does not exist, or might have been deleted. Alternatively, you may have posted the wrong link. \$\endgroup\$ – Erik the Outgolfer Dec 24 '16 at 21:49
3
\$\begingroup\$

Malbolge

Malbolge is a truly amazing language. Programs written in Malbolge are very, very, very impressive. Most of people when hearing Malbolge either have a devil in front of their eyes, or never heard about this. The whole point of this comparasion is to point out that Malbolge is really, really hyped language. You write something in Malbolge, as simple as cat? Here you go, grab some rep! Just for something as simple as cat! (but sometimes you will sink to the bottom).

Malbolge is very hard to modify, so I can take a bet that nobody, ever will try to crack your cops and robbers entry, and nobody will ever try to outgolf you in challenges other than those with Kologomorov complexity.

Malbolge also has very tight instruction set, so it's simple to learn basics of Malbolge to understand less hellish programs.

Malbolge is making simple challenges real challenges! You want some more fun from challenge? Go ahead and solve it in Malbolge. It will guarantee you a really fun time.

... and it's great on popularity contests, can you guess why?

\$\endgroup\$
  • 1
    \$\begingroup\$ Malbolge golfing is much easier than in other languages, because you don't need to golf the program and can still get an acceptable answer. \$\endgroup\$ – A̲̲ Aug 18 at 15:32
  • \$\begingroup\$ @A__ and nobody can outgolf you, unless his smart enough. \$\endgroup\$ – Krzysztof Szewczyk Aug 18 at 15:33
2
\$\begingroup\$

Keg

Keg is a tiny stack-based language that has outstanding ways to code-golf programs; it was commonly considered to be hard to golf in due to its limitations of commands; however, it has proven that it can write very short programs if the Keg user is intelligent enough to write short programs.

Ease of learning

Keg is a good target for code golf beginners. I find it much easier to pick up Keg and start code-golfing than any other language; in fact, all other golfing languages are complicated, and you usually have to look at the command reference before you start programming.

Keg has generally well thought-out utilities that are very easy to read without much professional help.

Simplicity

For other golfing languages, there are too many instructions which stops the user from thinking clearly; the user probably will waste too much time finding the instruction they want. When golfing in CJam, Mathematica, or Jelly, for example, your submission could be crippled if you didn't know about one key builtin that solves a huge part of the problem. in Keg, this barrier has been lowered; now provided only a few instructions, the user can use significantly less time for finding the instruction they want, as the instruction list is in their mind.

Features

In Keg, alphanumerical characters are automatically pushed (no need to wrap them in quotation marks); this makes it much easier to golf in. Other stack-based languages depend on quotation marks for manipulating the stack; in Keg, this is not the case.

Keg also has the commands ' and ", which are very useful compared to other commands that manipulate the stack(In fact, no other stacklang supports that; I can't find other languages that have those commands; however, inform me if there is).

It introduces implicit input and output

No more writing instructions to take input and process it, now you can write full programs which use input and implicit output without using built-in functions: ?,.. Instead of focusing on how best to get and manipulate your input, you can get right to work on the main algorithm of your program.

Keg is Still Being Developed

Keg is currently being actively maintained, and you can join to make Keg better. A lot of issues are fixed and more (unique?) features that make Keg easier to use are added.

\$\endgroup\$
1
\$\begingroup\$

Bean

I have a good explanation of the mechanics of the language here already, but I haven't really explained why it's good to golf in.

It is easy to get started in right away

For users of JavaScript ES6, there is almost no learning curve to using Bean, as the online interpreter automatically translates any valid JavaScript to Bean for you, and removes comments, directives, and whitespace from the bytecode, and provides a permalink immediately (though on the downside, the URLs can get a bit long).

It allows verbose builtins from JavaScript at very little cost

One of the main advantages of Bean is that all builtin namespace and class identifiers, as well as their static and member properties, only cost 1 byte each.

It introduces implicit input and output

No more writing functions to take input and process it, now you can write full programs which abuse pre-processed input and implicit output without using function arguments, prompt(), alert() or console.log(). Instead of focusing on how best to get and manipulate your input, you can get right to work on the main algorithm of your program.

It is new, stable, and active

So what are you waiting for? Turn your mediocre JavaScript ES6 submissions into rocking Bean submissions and show off those impressive looking hexdumps! If I can get enough people using this language to make it worthwhile, I'll even add a test suite mode to the online interpreter for multiple input, and an embed script to allow auto-generation of stack snippets.

\$\endgroup\$
-9
\$\begingroup\$

C#

C# is multi-paradigm language : structured, imperative, object-oriented, event-driven, task-driven, functional, generic, reflective, concurrent. You can do a lot with it. Also, he inherited a lot form C/C++. He is like Java but shorter. In the real world, you can use it to develop almost everywhere.

C# influenced Kotlin, Rust or Swift to name a few.

\$\endgroup\$
  • 1
    \$\begingroup\$ I dont think that C# is good for golfing. It is nice language in a nice environment. C# is a bit of a jack of all trades (master of none). If you just want to have a good time, you should try it. \$\endgroup\$ – aloisdg says Reinstate Monica Jul 21 '16 at 1:34
  • 12
    \$\begingroup\$ This doesn't really make a case for using C# on this site. \$\endgroup\$ – Alex A. Jul 21 '16 at 16:10
-15
\$\begingroup\$

Brainfuck because its fun. Its easy to learn (only 8 commands) and its Turing complete, so its very flexible.

\$\endgroup\$
  • 12
    \$\begingroup\$ Only having 8 commands does not necessarily entail being easy to learn. It's one thing to learn the syntax of a language and it's a very different thing to learn to write useful code in it. And being Turing-complete isn't IMO the same as being flexible: a flexible language makes it easy to do a wide range of things, not merely possible. \$\endgroup\$ – Peter Taylor Jul 20 '16 at 9:33
  • 5
    \$\begingroup\$ I agree that it's entertaining to golf in brainfuck, but I disagree with the rationale. Brainfuck is actually very difficult to master, and even more difficult to golf in. As with all Turing tarpits, one chooses brainfuck because it represents a challenge, even if the task at hand is straightforward in most languages. \$\endgroup\$ – Dennis Jul 21 '16 at 22:33
  • \$\begingroup\$ Brainfuck is not difficult to master - it is almost trivial to write any Brainfuck program given a small and straightforward task. The 'fun' part is actually golfing your program down into a reasonable size. \$\endgroup\$ – thepiercingarrow Jul 22 '16 at 4:59
  • \$\begingroup\$ Whitespace has fewer commands, and it harder to learn. \$\endgroup\$ – mbomb007 Jul 25 '16 at 15:43
  • 2
    \$\begingroup\$ @thepiercingarrow And no, it's not trivial. Go write a program to check if a number is prime. It took me hours to write and golf. \$\endgroup\$ – mbomb007 Jul 25 '16 at 15:44
  • \$\begingroup\$ @mbomb007 okay, is the input as a bytecode value (for example for 65, input A), or as a three-digit number (for example for 65, 065) ? \$\endgroup\$ – thepiercingarrow Jul 25 '16 at 18:19
  • \$\begingroup\$ @thepiercingarrow bytecode value. \$\endgroup\$ – mbomb007 Jul 25 '16 at 18:57
  • \$\begingroup\$ Where's the program? \$\endgroup\$ – Embodiment of Ignorance Feb 28 at 23:46

You must log in to answer this question.

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