[Ur] mapPartial reverses the list

Sergey Mironov grrwlf at gmail.com
Sun Aug 24 13:20:20 EDT 2014


Hi. I've discovered that [List.mapPartial] reverses the list.
Probably, it is not what user wants from function named [map*]. Should
we do the [reverse] before returning the final list to user?

Regards,
Sergey

PS  the code

fun mapPartial [a] [b] f =
    let
        fun mp' acc ls =
            case ls of
                [] => rev acc
              | x :: ls => mp' (case f x of
                                    None => acc
                                  | Some y => y :: acc) ls
    in
        mp' []
    end



More information about the Ur mailing list