gvx / goal

g()()()()('al') → "gooooal"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

g()('al')

g()('al') is a challenge whereby you need to write in as many languages as possible code which enables the code g()('al') to return the string "goal", the code g()()('al') to return the string "gooal", the code g()()()('al') return the string "goooal", etc.

Rules

  1. You are encouraged to break the rules, cleverly.
  2. When executed, the solution must print "goal" with sufficient o's to demonstrate the program's functionality.
  3. The code g()('al') must appear in the source.
  4. g()('al') must not be a string literal.
  5. 'al' must be a string, or your language's equivalent thereof. You may use your language's standard method of creating a string (e.x. C should use ", ruby may use either " or ').
  6. g()('al') may not print the string. If returning a string cannot be done in your language, you should submit rationale as to why this is impossible for a solution which prints a string to be accepted.
  7. You must be able to insert an infinite number of () calls without modification to your solution. Therefore solutions like this are incorrect.
  8. g()('al') must be a valid rvalue if applicable in your language.
  9. g('al') must return "gal".
  10. If you have a solution that is close, but does not meet these rules, submit it anyway. A close and interesting solution is better than no solution.

Previous Solutions

The more exciting solutions are original, not applying techniques that have already been discovered. The following generally applicable techniques have already been discovered:

Languages

Solved Likely Impossible Impossible
Bash
C
C#
C++
Clojure
Common Lisp
Go
Groovy
Haskell
Java
JavaScript
Julia
Lua
Objective-J
Perl
Python
R
Ruby
Scala
SH
BASH
ZSH

Help out, add some more languages!

About

g()()()()('al') → "gooooal"


Languages

Language:C 38.5%Language:Python 9.7%Language:C++ 9.0%Language:JavaScript 7.2%Language:C# 6.6%Language:Lua 3.7%Language:Ruby 3.5%Language:Haskell 3.4%Language:Scala 3.2%Language:Common Lisp 3.1%Language:Go 2.2%Language:Objective-J 1.9%Language:Clojure 1.6%Language:Perl 1.6%Language:Julia 1.5%Language:Shell 1.3%Language:R 1.3%Language:Groovy 0.9%