Qurak

Combine and rearrange lists

How-to 15 stappen, op volgorde uitgevoerd in één sessie. Elke stap is tegen de engine uitgevoerd en de uitvoer hieronder is wat hij opleverde.

Stap 1
v = {3, 1, 3, 2, 5, 4}
Uitvoer
{3, 1, 3, 2, 5, 4}
Stap 2
Sort[v]
Uitvoer
{1, 2, 3, 3, 4, 5}
Stap 3
Union[v]
Uitvoer
{1, 2, 3, 4, 5}
Stap 4
v
Uitvoer
{3, 1, 3, 2, 5, 4}
Stap 5
v = Union[v]
Uitvoer
{1, 2, 3, 4, 5}
Stap 6
v
Uitvoer
{1, 2, 3, 4, 5}
Stap 7
Reverse[v]
Uitvoer
{5, 4, 3, 2, 1}
Stap 8
RotateLeft[v, 2]
Uitvoer
{3, 4, 5, 1, 2}
Stap 9
RotateRight[v, 2]
Uitvoer
{4, 5, 1, 2, 3}
Stap 10
PadLeft[v, 10, x]
Uitvoer
{x, x, x, x, x, 1, 2, 3, 4, 5}
Stap 11
Partition[v, 2]
Uitvoer
{{1, 2}, {3, 4}}
Stap 12
Partition[v, 2, 1]
Uitvoer
{{1, 2}, {2, 3}, {3, 4}, {4, 5}}
Stap 13
Split[{1, 4, 1, 1, 1, 2, 2, 3, 3}]
Uitvoer
{{1}, {4}, {1, 1, 1}, {2, 2}, {3, 3}}
Stap 14
Flatten[{{a, b}, {c, {d}, e}, {f, {g, h}}}]
Uitvoer
{a, b, c, d, e, f, g, h}
Stap 15
Join[{a, b}, {c, d, e}, {f, g, h}]
Uitvoer
{a, b, c, d, e, f, g, h}

Gebruikte functies

Gerelateerde recepten

Alle recepten · Functiereferentie · Gebruik dit vanuit een MCP-client