Re: array of delegates

2016-04-13 Thread Alex via Digitalmars-d-learn
On Thursday, 14 April 2016 at 06:27:29 UTC, Ali Çehreli wrote: On 04/13/2016 04:39 PM, Alex wrote: > import std.algorithm; > indarr.map!(a => partial!(sg, a)); I think you want to generate a different delegate for each element where the first argument to sg is the value of that element (0, 1,

Re: array of delegates

2016-04-13 Thread Alex via Digitalmars-d-learn
On Thursday, 14 April 2016 at 05:54:38 UTC, David Skluzacek wrote: So, that message is a pretty cryptic, but the problem there is that map does its thing at runtime, but partial is a template and must be instantiated at compile time. Instead you can use std.meta.staticMap, by doing something l

Re: array of delegates

2016-04-13 Thread Ali Çehreli via Digitalmars-d-learn
On 04/13/2016 04:39 PM, Alex wrote: > import std.algorithm; > indarr.map!(a => partial!(sg, a)); I think you want to generate a different delegate for each element where the first argument to sg is the value of that element (0, 1, etc.). Since the second element of sg is a Props, you then want

Re: array of delegates

2016-04-13 Thread David Skluzacek via Digitalmars-d-learn
So, that message is a pretty cryptic, but the problem there is that map does its thing at runtime, but partial is a template and must be instantiated at compile time. Instead you can use std.meta.staticMap, by doing something like this: void main() { import std.stdio; import st