[Ur] mapPartial reverses the list

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


Oops, sorry. Looks like I am wrong. mapPartial is OK, My fault.

2014-08-24 21:20 GMT+04:00 Sergey Mironov <grrwlf at gmail.com>:
> 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