Re: [rust-dev] The 'for' syntax for iterators

2013-06-16 Thread Zoltán Tóth
On Thu, Jun 13, 2013 at 7:25 PM, Tim Chevalier catamorph...@gmail.comwrote: I found using higher-order functions directly to be much more naturalhttps://mail.mozilla.org/listinfo/rust-dev So true. ___ Rust-dev mailing list Rust-dev@mozilla.org

Re: [rust-dev] The 'for' syntax for iterators

2013-06-14 Thread Igor Bukanov
On 13 June 2013 19:25, Tim Chevalier catamorph...@gmail.com wrote: Personally, I almost never used list comprehensions when I programmed in Haskell -- I found using higher-order functions directly to be much more natural -- but that part is just my opinion. I second that. What one wants is a

[rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Noam Yorav-Raphael
Hello, I want to point something that may be a reason for changing the 'for' syntax for external iterators: list comprehensions. I find list comprehensions (and generator expressions) in Python to be something that makes Python code much more concise, and make Python much more fun for data

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Ziad Hatahet
Shouldn't we just be able to use map() and filter() routines to do the same? -- Ziad ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Noam Yorav-Raphael
I find the code much easier to comprehend that way. Also, I don't know how you can write nested comprehensions with map and filter. Also, with map and filter you have to give names to variables both for map and for filter. Contrast: [name for name. age in zip(names, ages) if age 30] with

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Tim Chevalier
At this point we're focusing on removing features from Rust. We're vanishingly unlikely to add list comprehensions at this point. Rust's audience is C and C++ programmers, who won't necessarily notice their absence anyway. (Personally, I almost never used list comprehensions when I programmed in

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Ziad Hatahet
Perhaps you can get around somewhat by using macros? I asked the following question on the mailing list a while back, so maybe something similar can be used here: https://mail.mozilla.org/pipermail/rust-dev/2013-May/004176.html -- Ziad ___ Rust-dev

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Ziad Hatahet
On Thu, Jun 13, 2013 at 10:43 AM, Ziad Hatahet hata...@gmail.com wrote: Perhaps you can get around somewhat by using macros? I asked the following question on the mailing list a while back, so maybe something similar can be used here:

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Noam Yorav-Raphael
Thanks for the answer! As I said, I really don't mean that list comprehensions should be added now - just that they may be added some time later, and that they're likely to use the same 'for' syntax. I believe you're going to find that rust's audience will be much wider than current C/C++

Re: [rust-dev] The 'for' syntax for iterators

2013-06-13 Thread Ziad Hatahet
This thread made its way to the Rust subreddit, where people posted a couple of implementations using macros. Very cool stuff! http://www.reddit.com/r/rust/comments/1gag3t/list_comprehensions_in_rust_iterator/ http://en.wikipedia.org/wiki/List_comprehension#Rust -- Ziad