logo       

Re: List comprehensions ranges: msg#00005

lang.nemerle.devel

Subject: Re: List comprehensions ranges

We had similar request / discussion here
http://nemerle.org/forum/viewtopic.php?t=220
The last post gives some nicer syntax:

for (0 <= i < 3) // 0, 1, 2
for (0 <= i <= 3) // 0, 1, 2, 3
for (0 <= i < 7 step 2) // 0, 2, 4, 6
for (0 <= i < 3 step -1) // 2, 1, 0

I guess this could be dressed as
foreach (i in $[0 <= i < arr.Length])
arr [i]

or something similar.


Programming Language Ruby has following syntax.

0 .. 5 : 1 2 3 4 5
0 ... 5 : 1 2 3 4

The problem is that such syntax differences are quite unintuitive and
hard to read...

--
Kamil Skalski
http://nazgul.omega.pl


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise