Sattolo cycle: Difference between revisions

Content added Content deleted
(Added solution for Action!)
(add BQN)
Line 595: Line 595:
20 30 10
20 30 10
16 19 15 21 14 22 11 20 13 17 18 12</pre>
16 19 15 21 14 22 11 20 13 17 18 12</pre>

=={{header|BQN}}==
Defines a function which takes the same imperative approach as the pseudocode given. Will not modify the array in place, but there is modification used to create the returned result.

<lang bqn>Sattolo ← {
Sattolo arr:
{
𝕊 i:
j ← (×וrand.Range) i
arr ⌽⌾(i‿j⊸⊏)↩
}¨⌽↕≠arr
arr
}

>(⋈Sattolo)¨⟨
⟨⟩
⟨10⟩
⟨10, 20⟩
⟨10, 20, 30⟩
⟨11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22⟩
⟩</lang>
'''Possible Output:'''
<lang bqn>┌─
╵ ⟨⟩
⟨ 10 ⟩
⟨ 20 10 ⟩
⟨ 20 30 10 ⟩
⟨ 17 20 15 22 19 21 16 14 18 13 12 11 ⟩
┘</lang>


=={{header|C}}==
=={{header|C}}==