The one I find easy to remember is to iterate by putting the length of a permutation of the previous iteration in front of all the previous iterations and then rotate it through.
rot:{1_x,1#x}
prm:{x{,/l rot\'x,\:l:#*x}/,!0}
^in front of^after. It doesn’t really matter but after avoid parens.
Oh, wait. This lists all permutations of a given length. Is that what you’re trying to do? I’m not clear what you expect of prm 1 0 1 0.
@PyGamer0 the last part of the program checks the type of the argument with @. the type error in ngn/k happens because the results from @ are symbols in this implementation. you could write it as {{$[x;,/x,''o'x^/:x;,x]}@$[`I<@x;!x;x]}
of course you can golf it more if you don't want to support both list and atom inputs