Cycles of a permutation: Difference between revisions
m
→{{header|Julia}}
(julia example) |
|||
Line 128:
=={{header|Julia}}==
Normally, the Permutations.jl Julia package could be used, but equivalent non-library code is used instead, as specified in the task.
Note that the Alf and Betty's notation for cycles seems inverted compared to the syntax in Permutations.jl
is therefore customizable in the code below so as to fit to either format, and the test function's code is specified so as to
duplicate the cycles as written in examples given in the task.
<lang julia>""" A Perm is a permutation in one-line form. `a` is a shuffled gapless 1-based range of Int. """
struct Perm
|