mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
roc format examples
This commit is contained in:
parent
7ed35eca50
commit
7908e8c176
32 changed files with 231 additions and 232 deletions
|
@ -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
|
||||
|
||||
_ ->
|
||||
[]
|
||||
|
|
|
@ -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
|
||||
|
||||
_ ->
|
||||
[]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue