Skip to main content
deleted 98 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

Alice, 13 bytes

M%/RM\ d&\tO/ 

Try it online!

Input via separate command-line arguments. Reverses the first line (and every other line after that).

Explanation

 At the beginning of each loop iteration there will always be zero on top of the stack (potentially as a string, but it will be converted to an integer implicitly once we need it). M Push the number of remaining command-line arguments, M. % Take the zero on top of the stack modulo M. This just gives zero as long as there are arguments left, otherwise this terminates the program due to the division by zero. / Switch to Ordinal mode. t Tail. Implicitly converts the zero to a string and splits off the last character. The purpose of this is to put an empty string below the zero, which increases the stack depth by one. M Retrieve the next command-line argument and push it as a string. / Switch back to Cardinal mode. d Push the stack depth, D. &\R Switch back to Ordinal mode and reverse the current line D times. O Print the (possibly reversed) line with a trailing linefeed. \ Switch back to Cardinal mode. The instruction pointer loops around and the program starts over from the beginning. 

Alice, 13 bytes

M%/RM\ d&\tO/ 

Try it online!

Input via separate command-line arguments. Reverses the first line (and every other line after that).

Alice, 13 bytes

M%/RM\ d&\tO/ 

Try it online!

Input via separate command-line arguments. Reverses the first line (and every other line after that).

Explanation

 At the beginning of each loop iteration there will always be zero on top of the stack (potentially as a string, but it will be converted to an integer implicitly once we need it). M Push the number of remaining command-line arguments, M. % Take the zero on top of the stack modulo M. This just gives zero as long as there are arguments left, otherwise this terminates the program due to the division by zero. / Switch to Ordinal mode. t Tail. Implicitly converts the zero to a string and splits off the last character. The purpose of this is to put an empty string below the zero, which increases the stack depth by one. M Retrieve the next command-line argument and push it as a string. / Switch back to Cardinal mode. d Push the stack depth, D. &\R Switch back to Ordinal mode and reverse the current line D times. O Print the (possibly reversed) line with a trailing linefeed. \ Switch back to Cardinal mode. The instruction pointer loops around and the program starts over from the beginning. 
deleted 98 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

Alice, 2013 bytes

M%/RaKQRM\ \iO%@w d&\tO/dn$@d& 

Try it online!Try it online!

Input via separate command-line arguments. Reverses every other line from the endfirst line (i.e. the lastand every other line is always reversed, but the first one may or may not be, depending on whether there's an even or odd number of lines in the inputafter that).

Alice, 20 bytes

/RaKQ \iO%@w /dn$@d& 

Try it online!

Reverses every other line from the end (i.e. the last line is always reversed, but the first one may or may not be, depending on whether there's an even or odd number of lines in the input).

Alice, 13 bytes

M%/RM\ d&\tO/ 

Try it online!

Input via separate command-line arguments. Reverses the first line (and every other line after that).

Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

Alice, 20 bytes

/RaKQ \iO%@w /dn$@d& 

Try it online!

Reverses every other line from the end (i.e. the last line is always reversed, but the first one may or may not be, depending on whether there's an even or odd number of lines in the input).