真的只是一点小问题!
This commit is contained in:
parent
f10bf55a2e
commit
b8308cff5d
|
@ -1,7 +1,7 @@
|
|||
module Algorithm_FSharp.QuickSort
|
||||
|
||||
// 序列切割算法
|
||||
// partition : ('a bool) -> 'a list -> 'a list * 'a list
|
||||
// partition : ('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
// 按pred切割序列,返回的元组中第一个元素是满足条件的元素序列,第二个元素是不满足条件的元素序列
|
||||
let rec partition pred lst =
|
||||
match lst with // 模式匹配
|
||||
|
@ -12,7 +12,7 @@ let rec partition pred lst =
|
|||
| true -> head::matched, unmatched // 若匹配谓词,则将其追加至matched的头部并返回
|
||||
| false -> matched, head::unmatched // 若不匹配谓词,将其追加至unmatched的头部并返回
|
||||
|
||||
// quicksort : 'T list -> 'T list
|
||||
// quicksort : 'a list -> 'a list
|
||||
// 快速排序的F#实现
|
||||
let rec quicksort i =
|
||||
match i with // 模式匹配
|
||||
|
|
Loading…
Reference in New Issue