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

@ -5,8 +5,8 @@ quicksort = \list, low, high ->
when partition low high list is
Pair partitionIndex partitioned ->
partitioned
|> quicksort low (partitionIndex - 1)
|> quicksort (partitionIndex + 1) high
|> quicksort low (partitionIndex - 1)
|> quicksort (partitionIndex + 1) high
swap : Nat, Nat, List a -> List a
@ -14,8 +14,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
_ ->
[]

View file

@ -7,8 +7,8 @@ quicksort = \originalList ->
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
@ -18,8 +18,8 @@ quicksort = \originalList ->
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
_ ->
[]