I was wondering if it were possible to use multiple languages in the same submission. Not a polyglot, but using each of the languages. I have two thoughts on this.

  1. One language invokes the other. Let's say we have a Ruby + JavaScript solution. Then, you could have, say, puts %x(node a) in run.rb and console.log(x=>x) in a, and have rub.rb be the main solution.
  2. Alternatively, each language could read the output of the previous language as input. E.g., invoke like <input> | <language a> | <langauge b>.

How would these be scored? How would it be consistent, concerning the usage of langs (e.g. multiple usages of the same lang)? How would it compare with each of its component languages? Should it be allowed at all? If not, why not?

Here is an example of a multi-language submission, using method 2:

J + Ruby, idk bytes

Ruby, ruby.rb:

p gets.split.map(&:to_i).map{|s|s+4}

J, j.ijs:

exit echo 1+i.10

Invoke like:

j.ijs | ruby.rb


[5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
  • 8
    \$\begingroup\$ Seems dubious, but I can't come up with a concrete why of why this is bad. \$\endgroup\$ – Rohan Jhunjhunwala Sep 20 '16 at 1:16
  • \$\begingroup\$ Would this ever be useful? \$\endgroup\$ – James Sep 20 '16 at 2:08
  • 1
    \$\begingroup\$ @DJMcMayhem Maybe, maybe not. It might be fun. Is BF useful? :P \$\endgroup\$ – Conor O'Brien Sep 20 '16 at 2:20
  • \$\begingroup\$ I feel like method 2 is a bit of a foul, the specialized invocation adds something not provided by either language. If method 1 is done from within a single file then maybe that's a feature? \$\endgroup\$ – Linus Sep 20 '16 at 2:54
  • \$\begingroup\$ This happens all the time with bash answers that also use sed, awk, dc, or bc, for example. \$\endgroup\$ – Digital Trauma Sep 26 '16 at 18:17
  • \$\begingroup\$ The dupe target specifically says it isn't concerned with scoring, so I'm reopening this. \$\endgroup\$ – Dennis Feb 27 '17 at 15:42

Yes, it's perfectly valid

The byte count of the solution would be the sum of the byte counts of any files involved, plus the length of any special invocations needed.

For your first example, you have this:

puts %x(node a)


This would be invoked as ruby run.rb, and would be in the language Ruby + nodeJS, with a byte count of 32, assuming no trailing newlines in the files.

For your second example, you could have something like this:

python -c 'print range(10)' | node -e 'console.log(x=>x*x)'

In this case, the byte count would be:

  • 15 bytes for the Python 2 program (print range(10))
  • 32 bytes for the non-standard invocation for a Python 2 program ( | node -e 'console.log(x=>x*x)')


  • 19 bytes for the nodeJS program (console.log(x=>x*x))
  • 30 bytes for the non-standard invocation for a nodeJS program (python -c 'print range(10)' | )

So, the byte count would be either 47 (counting Python 2 as the primary driver) or 49 (counting nodeJS as the primary driver). You would then choose the byte count more optimized for the scoring criteria (the 47 for , for example). The language for this submission would be Python 2 + nodeJS + sh (the sh is included because of the piping on the command line).

  • \$\begingroup\$ In the second scenario, one might want to golf it like python -c 'print range(10)'|node -e 'console.log(x=>x*x)'? \$\endgroup\$ – Conor O'Brien Sep 20 '16 at 11:09
  • 1
    \$\begingroup\$ @ConorO'Brien Sure, but I'd rather have readable examples over fully-golfed examples. \$\endgroup\$ – user45941 Sep 20 '16 at 11:12
  • \$\begingroup\$ Cool, just wondering. \$\endgroup\$ – Conor O'Brien Sep 20 '16 at 11:13
  • 3
    \$\begingroup\$ Bash answers do this all the time, invoking stuff like awk or bc. Yet they are often called just "bash". \$\endgroup\$ – PurkkaKoodari Sep 20 '16 at 12:14
  • 2
    \$\begingroup\$ @Pietu1998 I think that's because usually all the code goes in the .sh file \$\endgroup\$ – Martin Ender Sep 20 '16 at 16:34
  • \$\begingroup\$ @MartinEnder True. \$\endgroup\$ – PurkkaKoodari Sep 20 '16 at 16:38
  • \$\begingroup\$ @Pietu1998 they're often called bash + GNU Utils because that is more correct. I've also seen just bash called pure bash to make the distinction that it isn't using GNU utils. \$\endgroup\$ – Liam Sep 21 '16 at 11:51
  • 1
    \$\begingroup\$ Should most bash + GNU Utils answers be called GNU Util with a non-standard invocation then? This would save them at least the bytes for the name of one of the Utils. \$\endgroup\$ – Riley Sep 23 '16 at 18:40
  • 2
    \$\begingroup\$ I'm not sure why you'd count the program as either 47 or 49 bytes. python -c 'print range(10)' | node -e 'console.log(x=>x*x)' is 59 bytes long (less after stripping spaces), and that is the actual program. Shell scripts call different programs all the times, and they're never scored as commands to the first program plus pipe or something like that. \$\endgroup\$ – Dennis Dec 26 '16 at 16:56

You must log in to answer this question.

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