Re: Isn't using find with retro awkward?

2011-02-16 Thread jam
On Thu, 17 Feb 2011 00:05:15 +0100, Andrej Mitrovic wrote: > On 2/16/11, jam wrote: >> >> import std.stdio,std.algorithm,std.range,std.container; >> >> void main() >> { >> auto a = [5,1,2,3,4,5,1]; >> auto index = countUntil(retro(a),5)

Re: Isn't using find with retro awkward?

2011-02-16 Thread jam
On Wed, 16 Feb 2011 22:00:13 +0100, Andrej Mitrovic wrote: > On 2/16/11, jam wrote: >> void main() >> { >> auto a = [5,1,2,3,4,5,1]; >> auto index = countUntil(retro(a),5); >> writeln(a[a.length-1-index .. a.length]); >> } >> >>

Re: Isn't using find with retro awkward?

2011-02-16 Thread jam
On Wed, 16 Feb 2011 20:24:36 +0100, Andrej Mitrovic wrote: > The only thing I could come up with is exhausting the entire range to > get the length of a bidirectional range. But that's inefficient. Anyway > here's the dull thing: > > import std.stdio; > import std.range; > import std.array; > >

Re: Array types not treated uniformly when passed as ranges

2011-02-15 Thread jam
On Tue, 15 Feb 2011 09:00:54 -0500, Steven Schveighoffer wrote: > On Mon, 14 Feb 2011 21:18:39 -0500, jam wrote: > >> Hi all, >> >> Just curious as to the difference in the built-in variable length array >> vs. the std.container.Array and fixed length arrays whe

Array types not treated uniformly when passed as ranges

2011-02-14 Thread jam
Hi all, Just curious as to the difference in the built-in variable length array vs. the std.container.Array and fixed length arrays when it comes to using them in functions that take Ranges. For instance the following does not compile: import std.algorithm; import std.stdio; import std.range; im