def swap

bend-collections@1.0.0.0 · src/math/random/rand.bend:277

import bend-collections@1.0.0.0/src/math/random/rand.bend as Rand
import Base

277# exchange elements i and j (unchanged when either is out of range)
278def swap(-A: Data, +xs: List<&2, A>, +i: Nat, +j: Nat) -> List<&2, A>:
279  swap_m(A, xs, i, j, nth(A, xs, i), nth(A, xs, j))

Uses (4)

Used by (1)