Cycles of a permutation: Difference between revisions
m
syntax highlighting fixup automation
m (→{{header|Phix}}: better constants, camelCase->under_scores, eliminated 15s, added a tagstart builtin) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 131:
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.
<
struct Perm
a::Vector{Int}
Line 272:
testAlfBettyPerms()
</
<pre>
On Thursdays Alf and Betty should rearrange
Line 340:
=={{header|Phix}}==
{{trans|Wren}}
<!--<
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #7060A8;">requires</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"1.0.2"</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- (tagstart)</span>
Line 546:
<span style="color: #008080;">if</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">>=</span><span style="color: #000000;">9</span> <span style="color: #008080;">then</span> <span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"\n"</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
<!--</
Output identical to Julia/Wren
=={{header|Python}}==
{{trans|Julia}}
<
from math import lcm # in python 3.9+
Line 706:
SPE = permutestring(SPE, PFRI)
print(str(i+1).rjust(2), ' ', SPE, '\n' if i == 8 else '')
</
<pre>
Same as Quackery.
Line 713:
=={{header|Quackery}}==
<
--------
Line 1,079:
echo sp
friday cycle cypermute dup echo$ cr ]
drop</
{{out}}
Line 1,155:
I've also stuck rigidly to the Quackery entry's examples for ease of comparison.
<
import "./fmt" for Fmt
Line 1,395:
prev = PC.cyclePermute(prev, cycles3)
System.print(prev)
}</
{{out}}
|