Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,15 @@
proc sortThree[T](a, b, c: var T) =
# Bubble sort, why not?
while not (a <= b and b <= c):
if a > b: swap a, b
if b > c: swap b, c
proc testWith[T](a, b, c: T) =
var (x, y, z) = (a, b, c)
echo "Before: ", x, ", ", y, ", ", z
sortThree(x, y, z)
echo "After: ", x, ", ", y, ", ", z
testWith(6, 4, 2)
testWith(0.9, -37.1, 4.0)
testWith("lions", "tigers", "bears")