Overlapping String-Blocks

JavaScript (Node.js), 24 bytes

Saved 2 bytes thanks to @Grimy

Assumes that the returned string is printed on a terminal that supports ANSI escape codes. Contains the unprintable character ESC, which is escaped (no pun intended) as \x1B below.


This doesn't work on TIO, but you can Try it online! to see the raw output instead.


The CSI sequences used are:

  • ED (Erase in Display):


    where \$2\$ means "clear entire screen"

  • CUP (Cursor Position):


    which means "moves the cursor to row \$n\$, column \$m\$" where both \$n\$ and \$m\$ are omitted and implicitly set to \$1\$ (top-left corner of the screen).

Example output


R, 120, 111 110 107 bytes

function(x,`!`=ncol,M=array('',Reduce(pmax,Map(dim,x)))){for(m in x)M[1:!t(m),1:!m]=m

Try it online!

A function accepting a list of matrix of characters (3D input is accepted).

(as you can notice from the byte count, this is not very easy to do in R...)

  • -9 bytes thanks to @Giuseppe
  • -4 bytes thanks to @RobinRyder

Jelly, 3 bytes


Try it online!

Hadn't used Jelly in a while but I thought the challenge in the comments was beatable. Very directly uses logical and (a) to perform the stacking operation between each element of the input (/). Y is used to print in the required format.