How to instantiate a map with multiple functions

karthikeyan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 26 11:30:24 PST 2015


How to instantiate a map with multiple functions. I looked into 
the docs at 
http://dlang.org/phobos/std_algorithm_iteration.html#map. They 
contain a string which I suppose is a mixin and when I change "a" 
to some other name it results in an error for me. Are there any 
ways to use lambda functions directly instead of strings and any 
explanation of the strings used in the map example and why a is 
used will be helpful.

I tried reading the source 
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L520 .Some hint that "a" should be used at https://github.com/D-Programming-Language/phobos/blob/master/std/functional.d#L101 but how do I change that since map doesn't allow me any params to specify the parameter name. Also how can I map an array of tuples with two or more elements with a function of two or more params like unpack the tuple into a function like that. I am D beginner so any will insights will be very helpful for me.

I am using dmd version 2.069 on Linux Mint 15 - 64bit


More information about the Digitalmars-d-learn mailing list