Skip to main content
12 of 16
added 306 characters in body
primo
  • 33.7k
  • 5
  • 63
  • 142

Perl - 105 Bytes

#!perl -n print$i+$%2?l^(L,$i--%2?v48:C)[$i<4+$%2&vec$_,4*$-$i-3,1]:$/.($i=$--)x0 while$+=2*y/0-9/wPkz\\>?p~/ 

The above contains 6 unprintable characters, and is equivalent to the following:

#!perl -n print$i+$^F%2?l^(L,$i--%2?v48:C)[$i<4+$^F%2&vec$_,4*$^F-$i-3,1]:$/.($i=$^F--)x0 while$^F+=2*y/0-9/wPkz\\>?p\177~/ 

With each ^F replaced by a literal character 6 (ACK), and \177 replaced by character 127 (DEL).

The shebang is counted as 1, the second newline is uncessary. Input is taken from stdin.


Sample Usage

$ echo 0123 | perl seven-slash.pl /\ /\ /\ / / \ \/ \ /\ \ \ \/ $ echo 456789 | perl seven-slash.pl /\ \/\ /\ / \/\ /\ \/ \ / \/\ / \/ \/\ \ / \/\ 

Explanation

Output is generated one byte at a time. Each character is transliterated, and this is then interpretted as a bit array using vec. The bits are stored in the following way:

 /\ 56 \/\ 234 /\ \/ -> 56 01 \/\ 234 \/ 01 

Output alternates between 3 and 5 slashes, so that bits 56 spill over into 01 of the next digit. Bit 7 is not used.

primo
  • 33.7k
  • 5
  • 63
  • 142