Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
(a, b) = [b, a]

View file

@ -0,0 +1,3 @@
def swap(a, b) {
[b, a]
}

View file

@ -0,0 +1,3 @@
def (x, y) = swap(1, 3)
assert x == 3
assert y == 1

View file

@ -0,0 +1,8 @@
def listSwap = { a, i, j ->
assert (0..<(a.size())).containsAll([i,j]);
a[[j,i]] = a[[i,j]]
}
def list = [2,4,6,8]
listSwap(list, 1, 3)
assert list == [2,8,6,4]