10
\$\begingroup\$

I wrote this answer in this challenge using Vim script. I think I was really creative and got very proud of my solution.

But I am not so sure if this is legal because this program does not print its output to stdout but opens a Vim session with the output of the program.

This command will run the Vim script program I posted:

$ echo "This is a test line!" | vim - -c 'nm Q vEUWvEuWQ|norm Q'

This will open up Vim displaying this:

THIS is A test LINE!
~
~
~
~
~

I personally think that this is legal because it does display the correct solution but I am not sure if it counts because the result is displayed within Vim and not printed to stdout.

I am new to codegolf so I would like to hear from you if I can post more solutions like this to other programs.

| |
\$\endgroup\$
  • \$\begingroup\$ Well, even if it's not, you can write a language called—I don't know—vimgolf? whose interpreter is the bash script out=$(mktemp) ; vim - -c "$(<"$1")"'<Esc><Esc><Esc>:wq "$out"<CR>' ; cat "$out" ; rm "$out"! That should solve your problem for future challenges. \$\endgroup\$ – wchargin Oct 15 '15 at 5:01
  • \$\begingroup\$ Never thought of that! :) \$\endgroup\$ – wefwefa3 Oct 18 '15 at 10:02
6
\$\begingroup\$

I would personally consider it valid. However, when in doubt, you should always ask the question writer by commenting on the question. Although there are set defaults for inputs and output formats, what the question writer says will overwrite these defaults.

| |
\$\endgroup\$

You must log in to answer this question.

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