📜  partition sml - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:34.540000             🧑  作者: Mango

代码示例1
fun parition f xs = 
    let
        fun split x (xs,ys) =
            if f x
            then (x::xs,ys)
            else (xs, x::ys)

        val (trueList, falseList) = List.foldl (fn (x,y) => split x y) 
                                                   ([],[]) xs
    in
        (List.rev trueList, List.rev falseList)
    end