Re: delegate object instead of a literal

2011-08-15 Thread Joel Christensen
On 16-Aug-11 10:22 AM, Jonathan M Davis wrote: On Monday, August 15, 2011 14:28 Jonathan M Davis wrote: On Monday, August 15, 2011 02:25 Joel Christensen wrote: Ok, this is a good one I think. import std.string, std.algorithm, std.functional; bool isANum( dchar chr ) { return inPattern( chr,

Re: delegate object instead of a literal

2011-08-15 Thread Jonathan M Davis
On Monday, August 15, 2011 14:28 Jonathan M Davis wrote: > On Monday, August 15, 2011 02:25 Joel Christensen wrote: > > Ok, this is a good one I think. > > > > import std.string, std.algorithm, std.functional; > > > > bool isANum( dchar chr ) { > > return inPattern( chr, digits ~ `"+-.` ); > > }

Re: delegate object instead of a literal

2011-08-15 Thread Jonathan M Davis
On Monday, August 15, 2011 02:25 Joel Christensen wrote: > Ok, this is a good one I think. > > import std.string, std.algorithm, std.functional; > > bool isANum( dchar chr ) { > return inPattern( chr, digits ~ `"+-.` ); > } > > void main() { > auto input = `abc123`; > auto indexEnd = -1; > > in

Re: delegate object instead of a literal

2011-08-15 Thread Joel Christensen
Ok, this is a good one I think. import std.string, std.algorithm, std.functional; bool isANum( dchar chr ) { return inPattern( chr, digits ~ `"+-.` ); } void main() { auto input = `abc123`; auto indexEnd = -1; indexEnd = count!( not!isANum )( input ); assert( indexEnd =

Re: delegate object instead of a literal

2011-08-14 Thread Joel Christensen
On 15-Aug-11 5:21 PM, Joel Christensen wrote: On 15-Aug-11 2:55 PM, Jonathan M Davis wrote: On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: Hi, This program loops through a string until it finds a number and gives the position of it. The first assert works, but not the second one.

Re: delegate object instead of a literal

2011-08-14 Thread Joel Christensen
On 15-Aug-11 2:55 PM, Jonathan M Davis wrote: On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: Hi, This program loops through a string until it finds a number and gives the position of it. The first assert works, but not the second one. import std.algorithm; void main() {

Re: delegate object instead of a literal

2011-08-14 Thread Joel Christensen
On 14-Aug-11 10:44 PM, Jonathan M Davis wrote: On Sunday, August 14, 2011 03:23:39 Jonathan M Davis wrote: On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: Hi, This program loops through a string until it finds a number and gives the position of it. The first assert works, but not

Re: delegate object instead of a literal

2011-08-14 Thread Jonathan M Davis
On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: > Hi, > > This program loops through a string until it finds a number and gives > the position of it. > > The first assert works, but not the second one. > > import std.algorithm; > > void main() { > static bool isNumber( char in

Re: delegate object instead of a literal

2011-08-14 Thread Jonathan M Davis
On Sunday, August 14, 2011 03:23:39 Jonathan M Davis wrote: > On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: > > Hi, > > > > This program loops through a string until it finds a number and gives > > the position of it. > > > > The first assert works, but not the second one. > > > >

Re: delegate object instead of a literal

2011-08-14 Thread Jonathan M Davis
On Sunday, August 14, 2011 03:23:39 Jonathan M Davis wrote: > On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: > > Hi, > > > > This program loops through a string until it finds a number and gives > > the position of it. > > > > The first assert works, but not the second one. > > > >

Re: delegate object instead of a literal

2011-08-14 Thread Jonathan M Davis
On Sunday, August 14, 2011 20:50:03 Joel Christensen wrote: > Hi, > > This program loops through a string until it finds a number and gives > the position of it. > > The first assert works, but not the second one. > > import std.algorithm; > > void main() { > static bool isNumber( char in