FlatMapped function
Warning
This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.
Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.
Namespace: Microsoft.Quantum.Arrays
Package: Microsoft.Quantum.Standard
Given an array and a function that maps an array element to some output array, returns the concatenated output arrays for each array element.
function FlatMapped<'TInput, 'TOutput> (mapper : ('TInput -> 'TOutput[]), array : 'TInput[]) : 'TOutput[]
Input
mapper : 'TInput -> 'TOutput[]
A function from 'TInput
to 'TOutput[]
that is used to map array elements.
array : 'TInput[]
An array of elements.
Output : 'TOutput[]
An array of 'TOutput[]
which is the concatenation of all arrays generated by
the mapping function.
Type Parameters
'TInput
The type of array
elements.
'TOutput
The mapper
function returns arrays of this type.
Example
let Numbers = SequenceI(1, _); // generates numbers starting from 1
let values = FlatMapped(Numbers, [1, 2, 3]);
// values = [1, 1, 2, 1, 2, 3]
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for