Hello Phil Dawes,

There is a Haskell package that has the function mapM_ (at
http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Foldable.html#v:mapM-95-
). This function seems to be exactly what you want. I think that Rust should
probably have a similar function (for now let's call it map_ although there's
probably a more Rusty name). It'd have the signature fn map_(self, f: |T|).
Personally, I'd like that function however other Rust developers may disagree
(it's not a good idea to create a utility function for every case). If a map_
function is never created I'd personally like the for iter idiom. Alternatively,
one could use the map_or function (although x.map_or((), |x| { ... is kind of 
ugly).
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to