roc format examples

This commit is contained in:
Richard Feldman 2022-07-13 23:14:49 -04:00
parent 7ed35eca50
commit 7908e8c176
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
32 changed files with 231 additions and 232 deletions

View file

@ -14,8 +14,8 @@ quicksortHelp = \list, low, high ->
when partition low high list is
Pair partitionIndex partitioned ->
partitioned
|> quicksortHelp low (partitionIndex - 1)
|> quicksortHelp (partitionIndex + 1) high
|> quicksortHelp low (partitionIndex - 1)
|> quicksortHelp (partitionIndex + 1) high
else
list
@ -50,8 +50,8 @@ swap = \i, j, list ->
when Pair (List.get list i) (List.get list j) is
Pair (Ok atI) (Ok atJ) ->
list
|> List.set i atJ
|> List.set j atI
|> List.set i atJ
|> List.set j atI
_ ->
# to prevent a decrement on list