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, etc.). Since the second element of sg is a Props, you then want to call those delegates with a Props value (e.g. Props.p1).

The following works:

    import std.algorithm;
    auto mapped = indarr
                  .map!(a => (Props p) => sg(a, p))
                  .map!(d => d(Props.p1));

    writeln(mapped);

Ali

Yes exactly!
The idea is to save
auto mapped = indarr.map!(a => (Props p) => sg(a, p));
for later use and use it then
by mapped[someIndex](Props.p1) or mapped[someIndex](Props.p2) when needed.
Thank you very much! :)

Reply via email to