/*
lists all possible permutations of a given string
eg. /permute abc yields:
abc
acb
bac
bca
cab
cba
just a fun little snippet that i began shortening and it ended up quite tiny ;) uses indirect recursion
*/
alias permute {
var %x 0,%y
while ($regsub($1,(.{ $+ %x $+ })(.),\1,%y)) scon -r inc $(%x |,) $iif(? iswm $1,echo -a,permute %y) $2 $+ $regml(2)
}