RosettaCodeData/Task/Permutations/Uiua/permutations.uiua

7 lines
301 B
Plaintext

# Takes strict range 0..<n and generates n! permutations
# (from https://github.com/Omnikar/uiua-math/blob/main/lib.ua).
Perms ← ☇1⍉∧(≡↻⇡⟜↯+1⟜⊂):¤¤°⊂
Permute ← ≡⊏⊙¤⊸(Perms⇡⧻) # Generalised helper function.
⟜⧻Permute {"this" "is" "fine"} # Yoda simulator