Answers for "partition sml"

0

partition sml

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
Posted by: Guest on October-25-2020

Browse Popular Code Answers by Language