Compute the full image of one captured permutation under one pass of the determi...
https://datenvertrag.halowerk.com/v1/stack-sort-permutation-imageOverview
Compute the full image of one captured permutation under one pass of the deterministic West stack-sorting map. Read the word from left to right. Before pushing a new value, pop every smaller stack top into the output; after the final input, drain the stack. Return the entire output word. For example, [1,2,0] maps to [1,0,2], whereas [2,0,1] maps to [0,1,2]. This is a single pass and need not produce sorted order. The input is a permutation of exactly 0,...,n-1 for n=0..6; empty maps to empty.