|
Re: List comprehensions ranges: msg#00007lang.nemerle.devel
Fore completeness: in mathematics, '[' is inclusive, and '(' is exclusive. Thus: (0 .. 5) 1,2,3,4 [0 .. 5) 0,1,2,3,4 [0 .. 5] 0,1,2,3,4,5 Although the syntax proposed below is easier to parse. Sandro Kamil Skalski wrote: > 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 > > > ------------------------------------------------------------------------ > > _______________________________________________ > https://nemerle.org/mailman/listinfo/devel-en
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: List comprehensions ranges, mei |
|---|---|
| Next by Date: | use extension methods from derived class, mei |
| Previous by Thread: | Re: List comprehensions ranges, mei |
| Next by Thread: | use extension methods from derived class, mei |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |