Skip to main content
Commonmark migration
Source Link

V, 10 bytes

ò/ 0⏎b2dw0 

Try it online!

Explanation

ò " run the following, until an error occurs / 0⏎ " | goto next zero with space in front (errors if none) b " | jump one word back (to the beginning of element to pop) 2 " | twice (element & zero itself) dw " | | delete word 0 " | goto beginning of line 

Equivalent in Vim, 16 bytes

qq/ 0⏎b2dw0@qq@q 

Try it online!

Explanation

Pretty much the same, except recording a macro q and recursively call it:

qq " record macro q / 0⏎b2dw0 " same as in V @q " recursively call q (aborts on error) q " quit recording @q " execute the macro q 

V, 10 bytes

ò/ 0⏎b2dw0 

Try it online!

Explanation

ò " run the following, until an error occurs / 0⏎ " | goto next zero with space in front (errors if none) b " | jump one word back (to the beginning of element to pop) 2 " | twice (element & zero itself) dw " | | delete word 0 " | goto beginning of line 

Equivalent in Vim, 16 bytes

qq/ 0⏎b2dw0@qq@q 

Try it online!

Explanation

Pretty much the same, except recording a macro q and recursively call it:

qq " record macro q / 0⏎b2dw0 " same as in V @q " recursively call q (aborts on error) q " quit recording @q " execute the macro q 

V, 10 bytes

ò/ 0⏎b2dw0 

Try it online!

Explanation

ò " run the following, until an error occurs / 0⏎ " | goto next zero with space in front (errors if none) b " | jump one word back (to the beginning of element to pop) 2 " | twice (element & zero itself) dw " | | delete word 0 " | goto beginning of line 

Equivalent in Vim, 16 bytes

qq/ 0⏎b2dw0@qq@q 

Try it online!

Explanation

Pretty much the same, except recording a macro q and recursively call it:

qq " record macro q / 0⏎b2dw0 " same as in V @q " recursively call q (aborts on error) q " quit recording @q " execute the macro q 
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

V, 10 bytes

ò/ 0⏎b2dw0 

Try it online!

Explanation

ò " run the following, until an error occurs / 0⏎ " | goto next zero with space in front (errors if none) b " | jump one word back (to the beginning of element to pop) 2 " | twice (element & zero itself) dw " | | delete word 0 " | goto beginning of line 

Equivalent in Vim, 16 bytes

qq/ 0⏎b2dw0@qq@q 

Try it online!

Explanation

Pretty much the same, except recording a macro q and recursively call it:

qq " record macro q / 0⏎b2dw0 " same as in V @q " recursively call q (aborts on error) q " quit recording @q " execute the macro q