Permutations: Difference between revisions

m
→‎Functional Python: (pruned out an unused function, updated output)
(→‎Functional: Edited to preserve the input type, pylinted for Python 3, updated output.)
m (→‎Functional Python: (pruned out an unused function, updated output))
Line 5,647:
)
 
 
# identity :: a -> a
def identity(x):
'''The identity function.'''
return x
 
# FORMATTING ----------------------------------------------
 
 
# fTable :: String -> (a -> String) ->
Line 5,686 ⟶ 5,680:
main()</lang>
{{Out}}
<pre>([1, 2, 3)] -> [([1, 2, 3)],([2, 3, 1)],([3, 1, 2)],([2, 1, 3)],([1, 3, 2)],([3, 2, 1)]]
'abc' -> ['abc','bca','cab','bac','acb','cba']</pre>
[(1, 2, 3]) -> [[(1, 2, 3]),[(2, 3, 1]),[(3, 1, 2]),[(2, 1, 3]),[(1, 3, 2]),[(3, 2, 1)]]</pre>
'abc' -> ['abc','bca','cab','bac','acb','cba']</pre>
 
=={{header|Qi}}==
9,655

edits