Permutations: Difference between revisions

Added Scala
(Added Scala)
Line 1,416:
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
</pre>
=={{header|Scala}}==
 
There is a built-in function that works on any sequential collection. It could be used as follows given a List of symbols:
<lang>List('a, 'b, 'c).permutations foreach println</lang>
Output:
<pre>List('a, 'b, 'c)
List('a, 'c, 'b)
List('b, 'a, 'c)
List('b, 'c, 'a)
List('c, 'a, 'b)
List('c, 'b, 'a)</pre>
=={{header|Scheme}}==
<lang scheme>; translation of ocaml : mostly iterative, with auxiliary recursive functions for some loops
14

edits