Re: How to instantiate a map with multiple functions

2015-12-27 Thread karthikeyan via Digitalmars-d-learn
On Sunday, 27 December 2015 at 02:21:11 UTC, Ali Çehreli wrote: On 12/26/2015 05:26 PM, Karthikeyan wrote: > if I need to map on a array of tuples will that work with the tuple being > unpacked or do I need to get it as single element and do unpacking myself? Unfortunately, there is no

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Fusxfaranto via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:30:24 UTC, karthikeyan wrote: 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

Re: How to instantiate a map with multiple functions

2015-12-26 Thread karthikeyan via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:38:16 UTC, Fusxfaranto wrote: On Saturday, 26 December 2015 at 19:30:24 UTC, karthikeyan wrote: 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

How to instantiate a map with multiple functions

2015-12-26 Thread karthikeyan via Digitalmars-d-learn
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

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 11:46 AM, karthikeyan wrote: > Thanks but the following returns an error for me > >import std.algorithm.comparison : equal; >import std.range : chain; >int[] arr1 = [ 1, 2, 3, 4 ]; >int[] arr2 = [ 5, 6 ]; >auto dd = map!(z => z * z, c => c * c * c)(chain(arr1,

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Karthikeyan via Digitalmars-d-learn
On Sunday, 27 December 2015 at 00:27:12 UTC, Ali Çehreli wrote: On 12/26/2015 11:46 AM, karthikeyan wrote: > Thanks but the following returns an error for me > >import std.algorithm.comparison : equal; >import std.range : chain; >int[] arr1 = [ 1, 2, 3, 4 ]; >int[] arr2 = [ 5, 6

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Ali Çehreli via Digitalmars-d-learn
On 12/26/2015 05:26 PM, Karthikeyan wrote: > if I need to map on a array of tuples will that work with the tuple being > unpacked or do I need to get it as single element and do unpacking myself? Unfortunately, there is no automatic unpacking of tuples. The only exception that I know is when

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
I'm playing around with something also trying to apply multiple functions. In my case, a sample is some related group of measurements taken simultaneously, and I'm calculating a group of metrics from the measured data of each sample. This produces the correct results for the input data, and

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Sunday, 27 December 2015 at 03:22:50 UTC, Jay Norwood wrote: I would probably want to associate names with the tuple metric results, and I've seen that somewhere in the docs in parameter tuples. I suppose I'll try those in place of the current tuple ... This worked to associate names