Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
2 added 545 characters in body
source | link

axo, 13 bytes

[:|[1+{#;1;-_

Try it online!

Explanation

This started out as a port of thean alternative solution in my Wumpus answer, but that:

2%)[=]&=[O00.

This resulted in 18 bytes. AfterI ended up golfing it down to the 13 here,bytes you see above to adjust it more to the details actuallyway axo works. This 13-byte version then ended up being quite differentinspiring the improvement down to 11 bytes in Wumpus, so now it's actually closer to that version. The basic idea is still

As in Wumpus, in iteration i, the samebottom of the stack holds a(i)-1 and the top holds the first element of the ith run, but I'mwe're working with 0 and 1 instead of 10 and 2 (incrementing it only1 throughout, except for printing). I'll add a full explanation tomorrow when I'm sure I can't golf this any further.

[:    Store a copy of the top of the stack in register A.
|     Pull up a(i)-1 from the bottom of the stack.
[1+{  Print a(i).
#;    If a(i)-1 is 1, push the value in register A.
1;-   Push another copy of that value and subtract it from 1 to swap
      0 and 1 for the next run.
_     Jump back to the beginning of the program.

axo, 13 bytes

[:|[1+{#;1;-_

Try it online!

This started out as a port of the alternative solution in my Wumpus answer, but that resulted in 18 bytes. After golfing it down to 13 here, the details actually ended up being quite different. The basic idea is still the same, but I'm working with 0 and 1 instead of 1 and 2 (incrementing it only for printing). I'll add a full explanation tomorrow when I'm sure I can't golf this any further.

axo, 13 bytes

[:|[1+{#;1;-_

Try it online!

Explanation

This started out as a port of an alternative solution in my Wumpus answer:

2%)[=]&=[O00.

This resulted in 18 bytes. I ended up golfing it down to the 13 bytes you see above to adjust it more to the way axo works. This 13-byte version then ended up inspiring the improvement down to 11 bytes in Wumpus, so now it's actually closer to that version.

As in Wumpus, in iteration i, the bottom of the stack holds a(i)-1 and the top holds the first element of the ith run, but we're working with 0 and 1 throughout, except for printing.

[:    Store a copy of the top of the stack in register A.
|     Pull up a(i)-1 from the bottom of the stack.
[1+{  Print a(i).
#;    If a(i)-1 is 1, push the value in register A.
1;-   Push another copy of that value and subtract it from 1 to swap
      0 and 1 for the next run.
_     Jump back to the beginning of the program.
1
source | link

axo, 13 bytes

[:|[1+{#;1;-_

Try it online!

This started out as a port of the alternative solution in my Wumpus answer, but that resulted in 18 bytes. After golfing it down to 13 here, the details actually ended up being quite different. The basic idea is still the same, but I'm working with 0 and 1 instead of 1 and 2 (incrementing it only for printing). I'll add a full explanation tomorrow when I'm sure I can't golf this any further.