Skip to main content
added 942 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

/// and Retina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina. I'll add an explanation after I've checked whether

Explanation for ///

The first instruction is

/
//

removes all newlines from the rest of the code, resulting in

This program wasn't written in \/\/\/, it was built for Retina!/?./....(.*)(R.*)!$2$1///!

Everything up to the ! is just a different approach mightliteral and printed to STDOUT. The next instruction is

/?./....(.*)(R.*)!$2$1/

But the search string ?. cannot be shorterfound, so nothing happens. Then the remaining code is //! which is an incomplete instruction so the program terminates, having printed the correct string.

Explanation for Retina

/
//

This tells Retina to replace / with //. But the input is empty, so this doesn't match anything.

<empty>
This program wasn't written in \/\/\/, it was built for Retina!

This replaces the input with the string in the second line.

/?./....(.*)(R.*)!
$2$1///!

This matches the string \/\/\/, it was built for Retina! and replaces it with Retina, it was built for ///! to give the correct result.

/// and Retina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina. I'll add an explanation after I've checked whether a different approach might be shorter.

/// and Retina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina.

Explanation for ///

The first instruction is

/
//

removes all newlines from the rest of the code, resulting in

This program wasn't written in \/\/\/, it was built for Retina!/?./....(.*)(R.*)!$2$1///!

Everything up to the ! is just a literal and printed to STDOUT. The next instruction is

/?./....(.*)(R.*)!$2$1/

But the search string ?. cannot be found, so nothing happens. Then the remaining code is //! which is an incomplete instruction so the program terminates, having printed the correct string.

Explanation for Retina

/
//

This tells Retina to replace / with //. But the input is empty, so this doesn't match anything.

<empty>
This program wasn't written in \/\/\/, it was built for Retina!

This replaces the input with the string in the second line.

/?./....(.*)(R.*)!
$2$1///!

This matches the string \/\/\/, it was built for Retina! and replaces it with Retina, it was built for ///! to give the correct result.

added 71 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

////// and RetinaRetina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina. I'll add an explanation after I've checked whether a different approach might be shorter.

/// and Retina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina. I'll add an explanation after I've checked whether a different approach might be shorter.

/// and Retina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina. I'll add an explanation after I've checked whether a different approach might be shorter.

Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

/// and Retina, 95 + 3 = 98 bytes

/
//

This program wasn't written in \/\/\/, it was built for Retina!
/?./....(.*)(R.*)!
$2$1///!

+3 bytes for the -s flag in Retina. I'll add an explanation after I've checked whether a different approach might be shorter.