Hi, Would it be possible to leverage the macro system, so that a range can be expressed using an intuitive syntax ?
Something like : for range!(0 <= x < size) { io::print(x); } or for range!(10 > v >= 0) { io::print(v); } ----- Message d'origine ----- De : Niko Matsakis Envoyés : 06.03.13 14:45 À : Benjamin Striegel Objet : Re: [rust-dev] A question about using uint::range_rev() Yeah, I'm inclined to agree. Niko ben.strie...@gmail.com March 6, 2013 12:55 AM Hm, well that's unfortunate... I think that range_rev might just need to be rewritten to get the values in (i, j] rather than [i, j). _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev ryan.c...@samsung.com March 5, 2013 11:42 PM Hi all, I have a quick question about using uint::range_rev(). I'd like to express a for statement that decrements an uint value to 0. However I cannot use the below statement, because uint::range_rev(i,j) computes values in the range [i,j). for uint::range_rev(10,0) |i| { // do something } Sure I can express the statement using a combination of a while loop and an if statment, but is there a compact (or Rust) way of expressing i,..,j? Also, I think type casting to int, use int::range(i,-1), and type cast back to uint is only tricking the compiler. Thanks a lot. Regards, Ryan ---- Ryan Hyun Choi Senior Engineer Web Platform Lab. Software R&D Center Samsung Electronics Co., Ltd email: ryan.c...@samsung.com _______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev
<<inline: postbox-contact.jpg>>
<<inline: compose-unknown-contact.jpg>>
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev