sequential and the power of selfie programs

See the picture above. It shows…

a tiny program whose output is written on the program itself.

For this to happen, the program needs to have a way to store its output in a section of the code which is ignored by the compiler or interpreter (for example, in a comment)

I call these programs: selfie programs. #selfieprogram

Selfie programs are immensely powerful, showing at one glance what might require an otherwise long-winded description.

Here are some examples:

Selfie programs are not new

People have been using them for ever, without a need for formalising their notation.

A comment followed by some kind of right arrow seems to be the most common notation, but there are other similar flavours.

i=2*3; // --> 6
i=2*3; // ⇒ 6
//> 6

selfie programs are incredibly effective in communicating the author’s intentions because:

  1. They are self-contained (everything that is required is there and, crucially, nothing else)
  2. They are sequential (typically a few lines to set the use case, followed by one line to print the output)
  3. They care about user-experience: no need for your eyes to bounce from a code panel to an output panel.

…and so I wrote sequential

sequential is an environment to create and host a JavaScript selfie program.
Any code which runs on it uses console.log to print its result, which is automatically displayed as a comment.

It is the simplest JavaScript environment to explore possibilities, play with parameters, and see the outcome immediately.

And, if you wonder about external JavaScript libraries, I created a global load function to access them.

load just takes a string containing the URL of the JavaScript.
It typically relies on services like, cdnjs, jsdelivr, unpkg, wzrd and many others…

So, who is sequential for ?

If you are a JavaScript author you can use it to demonstrate your work by giving your audience the chance to explore your work and play with parameters.

If you are familiar with other code playgrounds (codepen, JSFiddle, …) you can think of sequential as a stripped out version design to solely focus on JavaScript functionalities.

Thanks for reading this.