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",
g()()('al') to return the string "gooal", the code
return the string "goooal", etc.
- You are encouraged to break the rules, cleverly.
- When executed, the solution must print "goal" with sufficient o's to demonstrate the program's functionality.
- The code
g()('al')must appear in the source.
g()('al')must not be a string literal.
'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
g()('al')must be a valid rvalue if applicable in your language.
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.
- You must be able to insert an arbitrary number of
()calls without modification to your solution. Therefore solutions like this are incorrect.
If you see a complete solution that breaks any of these rules, file a bug!
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.
The more exciting solutions are original, not applying techniques that have already been discovered. The following broadly applicable techniques have already been discovered:
|Finite State Transducer||•|
Help out, add some more languages!
Note: I'm not done making READMEs for all the languages yet. Don't let that stop you!
These are some of the editor's favorite submissions:
- Befunge solution by arcovion
- C solution by tolmasky
- C++ solution by derrickturk
- C# solution by scorpiona with an explanation
- Finite State Transducer solution by zippy-white
- Dynamic Linker solution by eatnumber1
- Haskell solution by capicue with an explanation
- Java solution by lawl with an explanation
- Nimrod solution by dom96
- Perl solution by worr with an explanation
- SH incomplete solution by csandreasen
- ZSH solution by o11c with an explanation