Skip to main content
2 of 2
deleted 2 characters in body
PhiNotPi
  • 29.1k
  • 10
  • 85
  • 157

Element, 20

_'[1+2:'.2:`\ ."\
`]

The main idea is that the stacks contain a string and a number. We repeatedly increment the number and append it to the string, printing the result. Given that Element has zero support for arrays, I think this is a very decent score.

Since most people are probably unfamiliar with this language, Element is a golfing language I created in 2012. You can see the most updated interpreter, written in Perl, here.

To make the explanation easier, I'll replace the newline with an L.

_'[1+2:'.2:`\ ."\L`]
_'                    input a number and put it onto the control stack
  [                ]  this is a FOR loop
   1+                 increment the number.  An empty stack is zero.
     2:               make a second copy of it
       '              put one copy on the control stack to save it
        .             append the other copy to the end of the string
         2:           make a second copy of the new string
           `          output one of them
            \ .       append a space to the other
               "      put the number from earlier pack onto the main stack
                \L`   output a newline, but the L should be an actual newline
PhiNotPi
  • 29.1k
  • 10
  • 85
  • 157