filter!(not!(predicate))(someInputRange) does not compile

2011-01-19 Thread Jens Mueller
Hi, I cannot make the following compile. import std.functional; import std.array; import std.algorithm; import std.stdio; void main() { auto numbers = [0, 1, 2, 3, 4, 5]; bool alwaysTrue(uint a) { return true; } alias not!(alwaysTrue) alwaysFalse; numbers = array(filter!(always

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-19 Thread Andrei Alexandrescu
On 1/19/11 5:53 PM, Jens Mueller wrote: Hi, I cannot make the following compile. import std.functional; import std.array; import std.algorithm; import std.stdio; void main() { auto numbers = [0, 1, 2, 3, 4, 5]; bool alwaysTrue(uint a) { return true; } alias not!(alwaysTrue) alw

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-19 Thread Jens Mueller
Andrei Alexandrescu wrote: > On 1/19/11 5:53 PM, Jens Mueller wrote: > >Hi, > > > >I cannot make the following compile. > > > >import std.functional; > >import std.array; > >import std.algorithm; > >import std.stdio; > > > >void main() { > > auto numbers = [0, 1, 2, 3, 4, 5]; > > > > bool a

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-19 Thread Andrei Alexandrescu
On 1/19/11 7:19 PM, Jens Mueller wrote: Andrei Alexandrescu wrote: On 1/19/11 5:53 PM, Jens Mueller wrote: Hi, I cannot make the following compile. import std.functional; import std.array; import std.algorithm; import std.stdio; void main() { auto numbers = [0, 1, 2, 3, 4, 5]; boo

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-20 Thread spir
On 01/20/2011 02:19 AM, Jens Mueller wrote: Thanks. Can you elaborate a bit please? I wonder why the alias won't work. Because in your original version the alias line does not define a func, but a kind of constant symbol. A higher order func like filter expects a func as first arg, not a cons

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-20 Thread Jens Mueller
Andrei Alexandrescu wrote: > On 1/19/11 7:19 PM, Jens Mueller wrote: > >Andrei Alexandrescu wrote: > >>Place the call to not!alwaysTrue in a local function inside main: > >> > >> bool alwaysFalse(uint a) { return not!alwaysTrue(a); } > > > >Thanks. Can you elaborate a bit please? I wonder why t

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-20 Thread Andrei Alexandrescu
On 1/20/11 12:47 PM, Jens Mueller wrote: Andrei Alexandrescu wrote: On 1/19/11 7:19 PM, Jens Mueller wrote: Andrei Alexandrescu wrote: Place the call to not!alwaysTrue in a local function inside main: bool alwaysFalse(uint a) { return not!alwaysTrue(a); } Thanks. Can you elaborate a bi

Re: filter!(not!(predicate))(someInputRange) does not compile

2011-01-20 Thread Jens K. Mueller
Andrei Alexandrescu wrote: > On 1/20/11 12:47 PM, Jens Mueller wrote: > >Andrei Alexandrescu wrote: > >>On 1/19/11 7:19 PM, Jens Mueller wrote: > >>>Andrei Alexandrescu wrote: > Place the call to not!alwaysTrue in a local function inside main: > > bool alwaysFalse(uint a) { return